@@ -345,7 +345,7 @@ impl Crate {
345345 clippy_args. push ( opt) ;
346346 }
347347 } else {
348- clippy_args. extend ( & [ "-Wclippy::pedantic" , "-Wclippy::cargo" ] )
348+ clippy_args. extend ( [ "-Wclippy::pedantic" , "-Wclippy::cargo" ] )
349349 }
350350
351351 if lint_filter. is_empty ( ) {
@@ -457,15 +457,11 @@ fn build_clippy() {
457457/// Read a `lintcheck_crates.toml` file
458458fn read_crates ( toml_path : & Path ) -> ( Vec < CrateSource > , RecursiveOptions ) {
459459 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( ) ) ) ;
461461 let crate_list: SourceList =
462462 toml:: from_str ( & toml_content) . unwrap_or_else ( |e| panic ! ( "Failed to parse {}: \n {}" , toml_path. display( ) , e) ) ;
463463 // 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 ( ) ;
469465
470466 // flatten TomlCrates into CrateSources (one TomlCrates may represent several versions of a crate =>
471467 // multiple Cratesources)
@@ -602,10 +598,10 @@ fn main() {
602598 ) {
603599 let shared_target_dir = "target/lintcheck/shared_target_dir" ;
604600 // 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) {
606602 if metadata. is_dir ( ) {
607603 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)
609605 . expect ( "failed to remove target/lintcheck/shared_target_dir" ) ;
610606 }
611607 }
@@ -779,7 +775,7 @@ fn read_stats_from_file(file_path: &Path) -> HashMap<String, usize> {
779775fn print_stats ( old_stats : HashMap < String , usize > , new_stats : HashMap < & String , usize > , lint_filter : & Vec < String > ) {
780776 let same_in_both_hashmaps = old_stats
781777 . 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) )
783779 . map ( |( k, v) | ( k. to_string ( ) , * v) )
784780 . collect :: < Vec < ( String , usize ) > > ( ) ;
785781
@@ -797,24 +793,24 @@ fn print_stats(old_stats: HashMap<String, usize>, new_stats: HashMap<&String, us
797793 // list all new counts (key is in new stats but not in old stats)
798794 new_stats_deduped
799795 . 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 ( ) )
801797 . for_each ( |( new_key, new_value) | {
802798 println ! ( "{} 0 => {}" , new_key, new_value) ;
803799 } ) ;
804800
805801 // list all changed counts (key is in both maps but value differs)
806802 new_stats_deduped
807803 . 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 ( ) )
809805 . 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 ( ) ;
811807 println ! ( "{} {} => {}" , new_key, old_val, new_val) ;
812808 } ) ;
813809
814810 // list all gone counts (key is in old status but not in new stats)
815811 old_stats_deduped
816812 . 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 ( ) )
818814 . filter ( |( old_key, _) | lint_filter. is_empty ( ) || lint_filter. contains ( old_key) )
819815 . for_each ( |( old_key, old_value) | {
820816 println ! ( "{} {} => 0" , old_key, old_value) ;
@@ -832,12 +828,12 @@ fn create_dirs(krate_download_dir: &Path, extract_dir: &Path) {
832828 panic ! ( "cannot create lintcheck target dir" ) ;
833829 }
834830 } ) ;
835- std:: fs:: create_dir ( & krate_download_dir) . unwrap_or_else ( |err| {
831+ std:: fs:: create_dir ( krate_download_dir) . unwrap_or_else ( |err| {
836832 if err. kind ( ) != ErrorKind :: AlreadyExists {
837833 panic ! ( "cannot create crate download dir" ) ;
838834 }
839835 } ) ;
840- std:: fs:: create_dir ( & extract_dir) . unwrap_or_else ( |err| {
836+ std:: fs:: create_dir ( extract_dir) . unwrap_or_else ( |err| {
841837 if err. kind ( ) != ErrorKind :: AlreadyExists {
842838 panic ! ( "cannot create crate extraction dir" ) ;
843839 }
@@ -863,7 +859,7 @@ fn lintcheck_test() {
863859 "lintcheck/test_sources.toml" ,
864860 ] ;
865861 let status = std:: process:: Command :: new ( "cargo" )
866- . args ( & args)
862+ . args ( args)
867863 . current_dir ( ".." ) // repo root
868864 . status ( ) ;
869865 //.output();
0 commit comments