From 5b9af76a4cf6179b696fc436f8367c137c26d6fb Mon Sep 17 00:00:00 2001 From: Jon Moroney Date: Sat, 24 Feb 2018 11:22:17 +0100 Subject: [PATCH] Access hashes directly for comparison --- src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index a2645f9..f1bfc5f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -108,7 +108,7 @@ fn main() { complete_files.par_sort_unstable_by(|a, b| b.file_len.cmp(&a.file_len)); complete_files.dedup_by(|a, b| if a.file_len==b.file_len { rayon::join(|| hash_and_update(a), || hash_and_update(b)); - if a==b { + if a.file_hash==b.file_hash { b.file_paths.extend(a.file_paths.drain()); true } else {false} @@ -155,6 +155,7 @@ fn hash_and_update(input: &mut Fileinfo) -> (){ } } input.file_hash=hasher.finish(); + assert_ne!(input.file_hash, 0); } Err(e) => {println!("Error:{} when opening {:?}. Skipping.", e, input.file_paths.iter().next().unwrap())} }