mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-24 10:41:43 +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,13 +238,10 @@ pub fn get_process(
|
||||
}
|
||||
}
|
||||
if guest_pull {
|
||||
match oci.annotations() {
|
||||
Some(a) => {
|
||||
if ImageService::is_sandbox(a) {
|
||||
return ImageService::get_pause_image_process();
|
||||
}
|
||||
if let Some(a) = oci.annotations() {
|
||||
if ImageService::is_sandbox(a) {
|
||||
return ImageService::get_pause_image_process();
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
}
|
||||
Ok(ocip.clone())
|
||||
|
@ -428,13 +428,10 @@ 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 {
|
||||
match src_ctrs.get(&shared_mount.src_ctr) {
|
||||
None => {
|
||||
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);
|
||||
}
|
||||
if src_ctrs.get(&shared_mount.src_ctr) == None {
|
||||
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);
|
||||
}
|
||||
Some(_) => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user