[all] Apply cargo fmt, and fix clippy warnings

This commit is contained in:
Ming-Hung Tsai
2021-10-19 22:35:06 +08:00
parent 13aeefcdeb
commit c8a1da1df9
39 changed files with 125 additions and 151 deletions

View File

@@ -64,7 +64,7 @@ impl XmlGen for CacheGen {
let mut cblocks = (0..self.nr_cache_blocks).collect::<Vec<u32>>();
cblocks.shuffle(&mut rand::thread_rng());
cblocks.truncate(nr_resident as usize);
cblocks.sort();
cblocks.sort_unstable();
v.mappings_b()?;
{

View File

@@ -222,9 +222,8 @@ where
let wrapper = build_args_fn(P::arg_type())?;
wrapper(&mut td, input.as_ref(), &|args: &[&OsStr]| {
let stderr = run_fail(P::cmd(args))?;
let msg = format!(
"This looks like XML. This tool only checks the binary metadata format.",
);
let msg =
"This looks like XML. This tool only checks the binary metadata format.".to_string();
assert!(stderr.contains(&msg));
Ok(())
})

View File

@@ -57,10 +57,10 @@ impl fmt::Display for Command {
fn log_output(output: &process::Output) {
use std::str::from_utf8;
if output.stdout.len() > 0 {
if !output.stdout.is_empty() {
eprintln!("stdout: \n{}<<END>>", from_utf8(&output.stdout).unwrap());
}
if output.stderr.len() > 0 {
if !output.stderr.is_empty() {
eprintln!("stderr: \n{}<<END>>", from_utf8(&output.stderr).unwrap());
}
}

View File

@@ -118,7 +118,7 @@ pub fn generate_metadata_leaks(
pub fn get_needs_check(md: &PathBuf) -> Result<bool> {
use thinp::thin::superblock::*;
let engine = SyncIoEngine::new(&md, 1, false)?;
let engine = SyncIoEngine::new(md, 1, false)?;
let sb = read_superblock(&engine, SUPERBLOCK_LOCATION)?;
Ok(sb.flags.needs_check)
}