@@ -345,7 +345,7 @@ impl Crate {
345
345
clippy_args. push ( opt) ;
346
346
}
347
347
} else {
348
- clippy_args. extend ( & [ "-Wclippy::pedantic" , "-Wclippy::cargo" ] )
348
+ clippy_args. extend ( [ "-Wclippy::pedantic" , "-Wclippy::cargo" ] )
349
349
}
350
350
351
351
if lint_filter. is_empty ( ) {
@@ -457,15 +457,11 @@ fn build_clippy() {
457
457
/// Read a `lintcheck_crates.toml` file
458
458
fn read_crates ( toml_path : & Path ) -> ( Vec < CrateSource > , RecursiveOptions ) {
459
459
let toml_content: String =
460
- std:: fs:: read_to_string ( & toml_path) . unwrap_or_else ( |_| panic ! ( "Failed to read {}" , toml_path. display( ) ) ) ;
460
+ std:: fs:: read_to_string ( toml_path) . unwrap_or_else ( |_| panic ! ( "Failed to read {}" , toml_path. display( ) ) ) ;
461
461
let crate_list: SourceList =
462
462
toml:: from_str ( & toml_content) . unwrap_or_else ( |e| panic ! ( "Failed to parse {}: \n {}" , toml_path. display( ) , e) ) ;
463
463
// parse the hashmap of the toml file into a list of crates
464
- let tomlcrates: Vec < TomlCrate > = crate_list
465
- . crates
466
- . into_iter ( )
467
- . map ( |( _cratename, tomlcrate) | tomlcrate)
468
- . collect ( ) ;
464
+ let tomlcrates: Vec < TomlCrate > = crate_list. crates . into_values ( ) . collect ( ) ;
469
465
470
466
// flatten TomlCrates into CrateSources (one TomlCrates may represent several versions of a crate =>
471
467
// multiple Cratesources)
@@ -602,10 +598,10 @@ fn main() {
602
598
) {
603
599
let shared_target_dir = "target/lintcheck/shared_target_dir" ;
604
600
// if we get an Err here, the shared target dir probably does simply not exist
605
- if let Ok ( metadata) = std:: fs:: metadata ( & shared_target_dir) {
601
+ if let Ok ( metadata) = std:: fs:: metadata ( shared_target_dir) {
606
602
if metadata. is_dir ( ) {
607
603
println ! ( "Clippy is newer than lint check logs, clearing lintcheck shared target dir..." ) ;
608
- std:: fs:: remove_dir_all ( & shared_target_dir)
604
+ std:: fs:: remove_dir_all ( shared_target_dir)
609
605
. expect ( "failed to remove target/lintcheck/shared_target_dir" ) ;
610
606
}
611
607
}
@@ -779,7 +775,7 @@ fn read_stats_from_file(file_path: &Path) -> HashMap<String, usize> {
779
775
fn print_stats ( old_stats : HashMap < String , usize > , new_stats : HashMap < & String , usize > , lint_filter : & Vec < String > ) {
780
776
let same_in_both_hashmaps = old_stats
781
777
. iter ( )
782
- . filter ( |( old_key, old_val) | new_stats. get :: < & String > ( & old_key) == Some ( old_val) )
778
+ . filter ( |( old_key, old_val) | new_stats. get :: < & String > ( old_key) == Some ( old_val) )
783
779
. map ( |( k, v) | ( k. to_string ( ) , * v) )
784
780
. collect :: < Vec < ( String , usize ) > > ( ) ;
785
781
@@ -797,24 +793,24 @@ fn print_stats(old_stats: HashMap<String, usize>, new_stats: HashMap<&String, us
797
793
// list all new counts (key is in new stats but not in old stats)
798
794
new_stats_deduped
799
795
. iter ( )
800
- . filter ( |( new_key, _) | old_stats_deduped. get :: < str > ( & new_key) . is_none ( ) )
796
+ . filter ( |( new_key, _) | old_stats_deduped. get :: < str > ( new_key) . is_none ( ) )
801
797
. for_each ( |( new_key, new_value) | {
802
798
println ! ( "{} 0 => {}" , new_key, new_value) ;
803
799
} ) ;
804
800
805
801
// list all changed counts (key is in both maps but value differs)
806
802
new_stats_deduped
807
803
. iter ( )
808
- . filter ( |( new_key, _new_val) | old_stats_deduped. get :: < str > ( & new_key) . is_some ( ) )
804
+ . filter ( |( new_key, _new_val) | old_stats_deduped. get :: < str > ( new_key) . is_some ( ) )
809
805
. for_each ( |( new_key, new_val) | {
810
- let old_val = old_stats_deduped. get :: < str > ( & new_key) . unwrap ( ) ;
806
+ let old_val = old_stats_deduped. get :: < str > ( new_key) . unwrap ( ) ;
811
807
println ! ( "{} {} => {}" , new_key, old_val, new_val) ;
812
808
} ) ;
813
809
814
810
// list all gone counts (key is in old status but not in new stats)
815
811
old_stats_deduped
816
812
. iter ( )
817
- . filter ( |( old_key, _) | new_stats_deduped. get :: < & String > ( & old_key) . is_none ( ) )
813
+ . filter ( |( old_key, _) | new_stats_deduped. get :: < & String > ( old_key) . is_none ( ) )
818
814
. filter ( |( old_key, _) | lint_filter. is_empty ( ) || lint_filter. contains ( old_key) )
819
815
. for_each ( |( old_key, old_value) | {
820
816
println ! ( "{} {} => 0" , old_key, old_value) ;
@@ -832,12 +828,12 @@ fn create_dirs(krate_download_dir: &Path, extract_dir: &Path) {
832
828
panic ! ( "cannot create lintcheck target dir" ) ;
833
829
}
834
830
} ) ;
835
- std:: fs:: create_dir ( & krate_download_dir) . unwrap_or_else ( |err| {
831
+ std:: fs:: create_dir ( krate_download_dir) . unwrap_or_else ( |err| {
836
832
if err. kind ( ) != ErrorKind :: AlreadyExists {
837
833
panic ! ( "cannot create crate download dir" ) ;
838
834
}
839
835
} ) ;
840
- std:: fs:: create_dir ( & extract_dir) . unwrap_or_else ( |err| {
836
+ std:: fs:: create_dir ( extract_dir) . unwrap_or_else ( |err| {
841
837
if err. kind ( ) != ErrorKind :: AlreadyExists {
842
838
panic ! ( "cannot create crate extraction dir" ) ;
843
839
}
@@ -863,7 +859,7 @@ fn lintcheck_test() {
863
859
"lintcheck/test_sources.toml" ,
864
860
] ;
865
861
let status = std:: process:: Command :: new ( "cargo" )
866
- . args ( & args)
862
+ . args ( args)
867
863
. current_dir ( ".." ) // repo root
868
864
. status ( ) ;
869
865
//.output();
0 commit comments