mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-11-13 00:53:04 +00:00
runtime-rs: Fix clippy manual_inspect
Manually fix `manual_inspect` clippy warning reported by rust 1.85.1.
```console
error: using `map` over `inspect`
--> crates/resource/src/cdi_devices/container_device.rs:50:10
|
50 | .map(|device| {
| ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_inspect
= note: `-D clippy::manual-inspect` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::manual_inspect)]`
help: try
|
50 ~ .inspect(|device| {
51 | // push every device's Device to agent_devices
52 ~ devices_agent.push(device.device.clone());
|
```
Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
@@ -47,10 +47,9 @@ pub fn annotate_container_devices(
|
||||
// Step 1: Extract all devices and filter out devices without device_info for vfio_devices
|
||||
let vfio_devices: Vec<ContainerDevice> = container_devices
|
||||
.into_iter()
|
||||
.map(|device| {
|
||||
.inspect(|device| {
|
||||
// push every device's Device to agent_devices
|
||||
devices_agent.push(device.device.clone());
|
||||
device
|
||||
devices_agent.push(device.device.clone())
|
||||
})
|
||||
.filter(|device| device.device_info.is_some())
|
||||
.collect();
|
||||
|
||||
@@ -103,13 +103,12 @@ impl SandboxBindMounts {
|
||||
// mount -o bind,ro host_shared mount_dest
|
||||
// host_shared: ${bindmount}
|
||||
mount::bind_mount_unchecked(Path::new(bindmount), &mount_dest, true, MsFlags::MS_SLAVE)
|
||||
.map_err(|e| {
|
||||
.inspect_err(|_| {
|
||||
for p in &mounted_list {
|
||||
nix::mount::umount(p).unwrap_or_else(|e| {
|
||||
error!(sl!(), "do umount failed: {:?}", e);
|
||||
});
|
||||
}
|
||||
e
|
||||
})?;
|
||||
|
||||
// default sandbox bind mounts mode is ro.
|
||||
|
||||
Reference in New Issue
Block a user