[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

@@ -66,7 +66,7 @@ fn mk_chunk_vecs(nr_blocks: u64, nr_jobs: u64) -> Vec<Vec<(u64, u64)>> {
}
pub fn pack(input_file: &Path, output_file: &Path) -> Result<(), Box<dyn Error>> {
let nr_blocks = get_nr_blocks(&input_file)?;
let nr_blocks = get_nr_blocks(input_file)?;
let nr_jobs = std::cmp::max(1, std::cmp::min(num_cpus::get() as u64, nr_blocks / 128));
let chunk_vecs = mk_chunk_vecs(nr_blocks, nr_jobs);
@@ -122,7 +122,7 @@ where
let kind = metadata_block_type(data);
if kind != BT::UNKNOWN {
z.write_u64::<LittleEndian>(b)?;
pack_block(&mut z, kind, &data)?;
pack_block(&mut z, kind, data)?;
written += 1;
if written == 1024 {

View File

@@ -442,7 +442,7 @@ mod tests {
let mut r = Cursor::new(&mut bs);
let unpacked = unpack(&mut r, ns.len() * 8).unwrap();
check_u64s_match(&ns, &unpacked[0..])
check_u64s_match(ns, &unpacked[0..])
}
#[test]
@@ -457,7 +457,7 @@ mod tests {
];
for t in &cases {
assert!(check_pack_u64s(&t));
assert!(check_pack_u64s(t));
}
}