mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-15 08:02:31 +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:
parent
4c467f57de
commit
d7dfab92be
@ -214,10 +214,7 @@ impl DragonballInner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::fs::remove_dir_all(&self.vm_path)
|
std::fs::remove_dir_all(&self.vm_path)
|
||||||
.map_err(|err| {
|
.inspect_err(|_| error!(sl!(), "failed to remove dir all for {}", &self.vm_path))
|
||||||
error!(sl!(), "failed to remove dir all for {}", &self.vm_path);
|
|
||||||
err
|
|
||||||
})
|
|
||||||
.ok();
|
.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,12 +302,11 @@ impl FcInner {
|
|||||||
self.umount_jail_resource("").ok();
|
self.umount_jail_resource("").ok();
|
||||||
}
|
}
|
||||||
std::fs::remove_dir_all(self.vm_path.as_str())
|
std::fs::remove_dir_all(self.vm_path.as_str())
|
||||||
.map_err(|err| {
|
.inspect_err(|err| {
|
||||||
error!(
|
error!(
|
||||||
sl(),
|
sl(),
|
||||||
"failed to remove dir all for {} with error: {:?}", &self.vm_path, &err
|
"failed to remove dir all for {} with error: {:?}", &self.vm_path, &err
|
||||||
);
|
)
|
||||||
err
|
|
||||||
})
|
})
|
||||||
.ok();
|
.ok();
|
||||||
}
|
}
|
||||||
|
@ -176,12 +176,11 @@ impl FcInner {
|
|||||||
self.cleanup_resource();
|
self.cleanup_resource();
|
||||||
|
|
||||||
std::fs::remove_dir_all(self.vm_path.as_str())
|
std::fs::remove_dir_all(self.vm_path.as_str())
|
||||||
.map_err(|err| {
|
.inspect_err(|err| {
|
||||||
error!(
|
error!(
|
||||||
sl(),
|
sl(),
|
||||||
"failed to remove dir all for {} with error: {:?}", &self.vm_path, &err
|
"failed to remove dir all for {} with error: {:?}", &self.vm_path, &err
|
||||||
);
|
)
|
||||||
err
|
|
||||||
})
|
})
|
||||||
.ok();
|
.ok();
|
||||||
|
|
||||||
|
@ -47,10 +47,9 @@ pub fn annotate_container_devices(
|
|||||||
// Step 1: Extract all devices and filter out devices without device_info for vfio_devices
|
// Step 1: Extract all devices and filter out devices without device_info for vfio_devices
|
||||||
let vfio_devices: Vec<ContainerDevice> = container_devices
|
let vfio_devices: Vec<ContainerDevice> = container_devices
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|device| {
|
.inspect(|device| {
|
||||||
// push every device's Device to agent_devices
|
// push every device's Device to agent_devices
|
||||||
devices_agent.push(device.device.clone());
|
devices_agent.push(device.device.clone())
|
||||||
device
|
|
||||||
})
|
})
|
||||||
.filter(|device| device.device_info.is_some())
|
.filter(|device| device.device_info.is_some())
|
||||||
.collect();
|
.collect();
|
||||||
|
@ -103,13 +103,12 @@ impl SandboxBindMounts {
|
|||||||
// mount -o bind,ro host_shared mount_dest
|
// mount -o bind,ro host_shared mount_dest
|
||||||
// host_shared: ${bindmount}
|
// host_shared: ${bindmount}
|
||||||
mount::bind_mount_unchecked(Path::new(bindmount), &mount_dest, true, MsFlags::MS_SLAVE)
|
mount::bind_mount_unchecked(Path::new(bindmount), &mount_dest, true, MsFlags::MS_SLAVE)
|
||||||
.map_err(|e| {
|
.inspect_err(|_| {
|
||||||
for p in &mounted_list {
|
for p in &mounted_list {
|
||||||
nix::mount::umount(p).unwrap_or_else(|e| {
|
nix::mount::umount(p).unwrap_or_else(|e| {
|
||||||
error!(sl!(), "do umount failed: {:?}", e);
|
error!(sl!(), "do umount failed: {:?}", e);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
e
|
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
// default sandbox bind mounts mode is ro.
|
// default sandbox bind mounts mode is ro.
|
||||||
|
Loading…
Reference in New Issue
Block a user