mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-31 07:19:06 +00:00
agent: Fix clippy unnecessary_get_then_check
Manually fix `unnecessary_get_then_check` clippy warning as suggested by rust 1.85.1. ```console warning: unnecessary use of `get(&shared_mount.src_ctr).is_none()` --> src/sandbox.rs:431:25 | 431 | if src_ctrs.get(&shared_mount.src_ctr).is_none() { | ---------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | help: replace it with: `!src_ctrs.contains_key(&shared_mount.src_ctr)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_get_then_check ``` Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
parent
54ec432178
commit
048178bc5e
@ -428,7 +428,7 @@ impl Sandbox {
|
||||
pub fn setup_shared_mounts(&self, c: &LinuxContainer, mounts: &Vec<SharedMount>) -> Result<()> {
|
||||
let mut src_ctrs: HashMap<String, i32> = HashMap::new();
|
||||
for shared_mount in mounts {
|
||||
if src_ctrs.get(&shared_mount.src_ctr).is_none() {
|
||||
if !src_ctrs.contains_key(&shared_mount.src_ctr) {
|
||||
if let Some(c) = self.find_container_by_name(&shared_mount.src_ctr) {
|
||||
src_ctrs.insert(shared_mount.src_ctr.clone(), c.init_process_pid);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user