warning_fix: fix warnings when build with cargo-1.68.0

Fixes: #6593

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
This commit is contained in:
alex.lyn
2023-04-26 19:18:49 +08:00
parent 509bc8b6c8
commit 17daeb9dd7
20 changed files with 91 additions and 75 deletions

View File

@@ -225,7 +225,7 @@ mod arch_specific {
expected_param_value
);
return Err(anyhow!("{} {}", error_msg, action_msg));
Err(anyhow!("{} {}", error_msg, action_msg))
}
}

View File

@@ -326,9 +326,7 @@ fn setup_client(server_url: String, dbg_console_port: u32) -> anyhow::Result<Uni
vsock.setup_sock().context("set up vsock")
}
// Others will be INVALID URI.
_ => {
return Err(anyhow!("invalid URI scheme: {:?}", scheme));
}
_ => Err(anyhow!("invalid URI scheme: {:?}", scheme)),
}
}

View File

@@ -162,7 +162,7 @@ pub fn get_sandbox_id_for_volume(volume_path: &str) -> Result<String> {
return Ok(String::from(file_name));
}
return Err(anyhow!("no sandbox found for {}", volume_path));
Err(anyhow!("no sandbox found for {}", volume_path))
}
#[cfg(test)]

View File

@@ -53,7 +53,7 @@ const UNKNOWN: &str = "unknown";
fn get_field_fn(line: &str, delimiter: &str, file_name: &str) -> Result<String> {
let fields: Vec<&str> = line.split(delimiter).collect();
if fields.len() < 2 {
return Err(anyhow!("Unexpected file contents for {}", file_name));
Err(anyhow!("Unexpected file contents for {}", file_name))
} else {
let val = fields[1].trim();
Ok(String::from(val))