@@ -568,16 +568,13 @@ impl DuplicateFinder {
568
568
let name = file_entry. path . to_string_lossy ( ) . to_string ( ) ;
569
569
if !loaded_hash_map2. contains_key ( & name) {
570
570
// If loaded data doesn't contains current image info
571
- non_cached_files_to_check. entry ( file_entry. size ) . or_insert_with ( Vec :: new) ;
572
- non_cached_files_to_check. get_mut ( & file_entry. size ) . unwrap ( ) . push ( file_entry. clone ( ) ) ;
571
+ non_cached_files_to_check. entry ( file_entry. size ) . or_insert_with ( Vec :: new) . push ( file_entry. clone ( ) ) ;
573
572
} else if file_entry. size != loaded_hash_map2. get ( & name) . unwrap ( ) . size || file_entry. modified_date != loaded_hash_map2. get ( & name) . unwrap ( ) . modified_date {
574
573
// When size or modification date of image changed, then it is clear that is different image
575
- non_cached_files_to_check. entry ( file_entry. size ) . or_insert_with ( Vec :: new) ;
576
- non_cached_files_to_check. get_mut ( & file_entry. size ) . unwrap ( ) . push ( file_entry. clone ( ) ) ;
574
+ non_cached_files_to_check. entry ( file_entry. size ) . or_insert_with ( Vec :: new) . push ( file_entry. clone ( ) ) ;
577
575
} else {
578
576
// Checking may be omitted when already there is entry with same size and modification date
579
- records_already_cached. entry ( file_entry. size ) . or_insert_with ( Vec :: new) ;
580
- records_already_cached. get_mut ( & file_entry. size ) . unwrap ( ) . push ( file_entry. clone ( ) ) ;
577
+ records_already_cached. entry ( file_entry. size ) . or_insert_with ( Vec :: new) . push ( file_entry. clone ( ) ) ;
581
578
}
582
579
}
583
580
}
@@ -602,8 +599,7 @@ impl DuplicateFinder {
602
599
}
603
600
match hash_calculation ( & mut buffer, file_entry, & check_type, 0 ) {
604
601
Ok ( hash_string) => {
605
- hashmap_with_hash. entry ( hash_string. clone ( ) ) . or_insert_with ( Vec :: new) ;
606
- hashmap_with_hash. get_mut ( hash_string. as_str ( ) ) . unwrap ( ) . push ( file_entry. clone ( ) ) ;
602
+ hashmap_with_hash. entry ( hash_string. clone ( ) ) . or_insert_with ( Vec :: new) . push ( file_entry. clone ( ) ) ;
607
603
}
608
604
Err ( s) => errors. push ( s) ,
609
605
}
@@ -624,17 +620,15 @@ impl DuplicateFinder {
624
620
625
621
// Add data from cache
626
622
for ( size, vec_file_entry) in & records_already_cached {
627
- pre_checked_map. entry ( * size) . or_insert_with ( Vec :: new) ;
628
- pre_checked_map. get_mut ( size) . unwrap ( ) . append ( & mut vec_file_entry. clone ( ) ) ;
623
+ pre_checked_map. entry ( * size) . or_insert_with ( Vec :: new) . append ( & mut vec_file_entry. clone ( ) ) ;
629
624
}
630
625
631
626
// Check results
632
627
for ( size, hash_map, errors) in & pre_hash_results {
633
628
self . text_messages . warnings . append ( & mut errors. clone ( ) ) ;
634
629
for vec_file_entry in hash_map. values ( ) {
635
630
if vec_file_entry. len ( ) > 1 {
636
- pre_checked_map. entry ( * size) . or_insert_with ( Vec :: new) ;
637
- pre_checked_map. get_mut ( size) . unwrap ( ) . append ( & mut vec_file_entry. clone ( ) ) ;
631
+ pre_checked_map. entry ( * size) . or_insert_with ( Vec :: new) . append ( & mut vec_file_entry. clone ( ) ) ;
638
632
}
639
633
}
640
634
}
@@ -732,16 +726,14 @@ impl DuplicateFinder {
732
726
let mut found: bool = false ;
733
727
for loaded_file_entry in loaded_vec_file_entry {
734
728
if file_entry. path == loaded_file_entry. path && file_entry. modified_date == loaded_file_entry. modified_date {
735
- records_already_cached. entry ( file_entry. size ) . or_insert_with ( Vec :: new) ;
736
- records_already_cached. get_mut ( & file_entry. size ) . unwrap ( ) . push ( loaded_file_entry. clone ( ) ) ;
729
+ records_already_cached. entry ( file_entry. size ) . or_insert_with ( Vec :: new) . push ( loaded_file_entry. clone ( ) ) ;
737
730
found = true ;
738
731
break ;
739
732
}
740
733
}
741
734
742
735
if !found {
743
- non_cached_files_to_check. entry ( file_entry. size ) . or_insert_with ( Vec :: new) ;
744
- non_cached_files_to_check. get_mut ( & file_entry. size ) . unwrap ( ) . push ( file_entry) ;
736
+ non_cached_files_to_check. entry ( file_entry. size ) . or_insert_with ( Vec :: new) . push ( file_entry) ;
745
737
}
746
738
}
747
739
}
@@ -768,8 +760,7 @@ impl DuplicateFinder {
768
760
match hash_calculation ( & mut buffer, & file_entry, & check_type, u64:: MAX ) {
769
761
Ok ( hash_string) => {
770
762
file_entry. hash = hash_string. clone ( ) ;
771
- hashmap_with_hash. entry ( hash_string. clone ( ) ) . or_insert_with ( Vec :: new) ;
772
- hashmap_with_hash. get_mut ( hash_string. as_str ( ) ) . unwrap ( ) . push ( file_entry) ;
763
+ hashmap_with_hash. entry ( hash_string. clone ( ) ) . or_insert_with ( Vec :: new) . push ( file_entry) ;
773
764
}
774
765
Err ( s) => errors. push ( s) ,
775
766
}
@@ -785,17 +776,15 @@ impl DuplicateFinder {
785
776
for ( full_size, full_hashmap, _errors) in & mut full_hash_results {
786
777
if size == * full_size {
787
778
for file_entry in vec_file_entry {
788
- full_hashmap. entry ( file_entry. hash . clone ( ) ) . or_insert_with ( Vec :: new) ;
789
- full_hashmap. get_mut ( & file_entry. hash ) . unwrap ( ) . push ( file_entry) ;
779
+ full_hashmap. entry ( file_entry. hash . clone ( ) ) . or_insert_with ( Vec :: new) . push ( file_entry) ;
790
780
}
791
781
continue ' main;
792
782
}
793
783
}
794
784
// Size doesn't exists add results to files
795
785
let mut temp_hashmap: BTreeMap < String , Vec < FileEntry > > = Default :: default ( ) ;
796
786
for file_entry in vec_file_entry {
797
- temp_hashmap. entry ( file_entry. hash . clone ( ) ) . or_insert_with ( Vec :: new) ;
798
- temp_hashmap. get_mut ( & file_entry. hash ) . unwrap ( ) . push ( file_entry) ;
787
+ temp_hashmap. entry ( file_entry. hash . clone ( ) ) . or_insert_with ( Vec :: new) . push ( file_entry) ;
799
788
}
800
789
full_hash_results. push ( ( size, temp_hashmap, Vec :: new ( ) ) ) ;
801
790
}
@@ -830,8 +819,7 @@ impl DuplicateFinder {
830
819
self . text_messages . warnings . append ( & mut errors) ;
831
820
for ( _hash, vec_file_entry) in hash_map {
832
821
if vec_file_entry. len ( ) > 1 {
833
- self . files_with_identical_hashes . entry ( size) . or_insert_with ( Vec :: new) ;
834
- self . files_with_identical_hashes . get_mut ( & size) . unwrap ( ) . push ( vec_file_entry) ;
822
+ self . files_with_identical_hashes . entry ( size) . or_insert_with ( Vec :: new) . push ( vec_file_entry) ;
835
823
}
836
824
}
837
825
}
@@ -1374,8 +1362,7 @@ pub fn load_hashes_from_file(text_messages: &mut Messages, delete_outdated_cache
1374
1362
hash : uuu[ 3 ] . to_string ( ) ,
1375
1363
symlink_info : None ,
1376
1364
} ;
1377
- hashmap_loaded_entries. entry ( file_entry. size ) . or_insert_with ( Vec :: new) ;
1378
- hashmap_loaded_entries. get_mut ( & file_entry. size ) . unwrap ( ) . push ( file_entry) ;
1365
+ hashmap_loaded_entries. entry ( file_entry. size ) . or_insert_with ( Vec :: new) . push ( file_entry) ;
1379
1366
}
1380
1367
}
1381
1368
0 commit comments