diff options
author | Jon Moroney <darakian@gmail.com> | 2020-08-02 14:33:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-02 14:33:47 -0700 |
commit | 3636ebf4247fe4625a306715e96c51d26327acdf (patch) | |
tree | 89a6dd50232f76e2798034b207527d5d088ac0b8 | |
parent | 4e7c67c9260e6bd43f8d8ce4619a983017ca3366 (diff) | |
parent | 806821e6cc9292f817821899253f61d04d61f3f4 (diff) |
Merge pull request #34 from darakian/skip-hash-unwrap
Skip unrapping hashes in comparison
-rw-r--r-- | src/lib.rs | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -331,9 +331,9 @@ fn differentiate_and_consolidate(file_length: u64, mut files: Vec<Fileinfo>) -> }); return dedupe(files) } - let mut partial_hashes: HashMap<u128, u64> = HashMap::new(); + let mut partial_hashes: HashMap<Option<u128>, u64> = HashMap::new(); for file in files.iter(){ - match partial_hashes.entry(file.get_partial_hash().unwrap()){ + match partial_hashes.entry(file.get_partial_hash()){ Entry::Vacant(e) => { e.insert(0); }, Entry::Occupied(mut e) => {*e.get_mut()+=1;} } @@ -344,7 +344,7 @@ fn differentiate_and_consolidate(file_length: u64, mut files: Vec<Fileinfo>) -> .map(|y| y.0) .collect(); files.par_iter_mut().for_each(|x| - if dedupe_hashes.contains(&x.get_partial_hash().unwrap()){ + if dedupe_hashes.contains(&x.get_partial_hash()){ let hash = x.generate_hash(HashMode::Full); x.set_full_hash(hash); } |