mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-24 18:52:08 +00:00
agent: Fix clippy single_match
Fix `single_match` clippy warning as suggested by rust 1.85.1. ```console warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> src/image.rs:241:9 | 241 | / match oci.annotations() { 242 | | Some(a) => { 243 | | if ImageService::is_sandbox(a) { 244 | | return ImageService::get_pause_image_process(); ... | 247 | | None => {} 248 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match help: try | 241 ~ if let Some(a) = oci.annotations() { 242 + if ImageService::is_sandbox(a) { 243 + return ImageService::get_pause_image_process(); 244 + } 245 + } | ``` Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
parent
e99070afb4
commit
7ff34f00c2
@ -238,14 +238,11 @@ pub fn get_process(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if guest_pull {
|
if guest_pull {
|
||||||
match oci.annotations() {
|
if let Some(a) = oci.annotations() {
|
||||||
Some(a) => {
|
|
||||||
if ImageService::is_sandbox(a) {
|
if ImageService::is_sandbox(a) {
|
||||||
return ImageService::get_pause_image_process();
|
return ImageService::get_pause_image_process();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ok(ocip.clone())
|
Ok(ocip.clone())
|
||||||
}
|
}
|
||||||
|
@ -428,14 +428,11 @@ impl Sandbox {
|
|||||||
pub fn setup_shared_mounts(&self, c: &LinuxContainer, mounts: &Vec<SharedMount>) -> Result<()> {
|
pub fn setup_shared_mounts(&self, c: &LinuxContainer, mounts: &Vec<SharedMount>) -> Result<()> {
|
||||||
let mut src_ctrs: HashMap<String, i32> = HashMap::new();
|
let mut src_ctrs: HashMap<String, i32> = HashMap::new();
|
||||||
for shared_mount in mounts {
|
for shared_mount in mounts {
|
||||||
match src_ctrs.get(&shared_mount.src_ctr) {
|
if src_ctrs.get(&shared_mount.src_ctr) == None {
|
||||||
None => {
|
|
||||||
if let Some(c) = self.find_container_by_name(&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);
|
src_ctrs.insert(shared_mount.src_ctr.clone(), c.init_process_pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(_) => {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are no shared mounts to be set up, return directly.
|
// If there are no shared mounts to be set up, return directly.
|
||||||
|
Loading…
Reference in New Issue
Block a user