@@ -144,12 +144,12 @@ impl ClippyWarning {
144144 }
145145
146146 let mut output = String :: from ( "| " ) ;
147- let _ = write ! ( output, "[`{}`]({}#L{})" , file_with_pos , file , self . line) ;
147+ let _ = write ! ( output, "[`{file_with_pos }`]({file }#L{})" , self . line) ;
148148 let _ = write ! ( output, r#" | `{:<50}` | "{}" |"# , self . lint_type, self . message) ;
149149 output. push ( '\n' ) ;
150150 output
151151 } else {
152- format ! ( "{} {} \" {}\" \n " , file_with_pos , self . lint_type, self . message)
152+ format ! ( "{file_with_pos } {} \" {}\" \n " , self . lint_type, self . message)
153153 }
154154 }
155155}
@@ -161,10 +161,10 @@ fn get(path: &str) -> Result<ureq::Response, ureq::Error> {
161161 match ureq:: get ( path) . call ( ) {
162162 Ok ( res) => return Ok ( res) ,
163163 Err ( e) if retries >= MAX_RETRIES => return Err ( e) ,
164- Err ( ureq:: Error :: Transport ( e) ) => eprintln ! ( "Error: {}" , e ) ,
164+ Err ( ureq:: Error :: Transport ( e) ) => eprintln ! ( "Error: {e}" ) ,
165165 Err ( e) => return Err ( e) ,
166166 }
167- eprintln ! ( "retrying in {} seconds..." , retries ) ;
167+ eprintln ! ( "retrying in {retries } seconds..." ) ;
168168 thread:: sleep ( Duration :: from_secs ( retries as u64 ) ) ;
169169 retries += 1 ;
170170 }
@@ -181,11 +181,11 @@ impl CrateSource {
181181 let krate_download_dir = PathBuf :: from ( LINTCHECK_DOWNLOADS ) ;
182182
183183 // url to download the crate from crates.io
184- let url = format ! ( "https://crates.io/api/v1/crates/{}/{}/download" , name , version ) ;
185- println ! ( "Downloading and extracting {} {} from {}" , name , version , url ) ;
184+ let url = format ! ( "https://crates.io/api/v1/crates/{name }/{version }/download" ) ;
185+ println ! ( "Downloading and extracting {name } {version } from {url}" ) ;
186186 create_dirs ( & krate_download_dir, & extract_dir) ;
187187
188- let krate_file_path = krate_download_dir. join ( format ! ( "{}-{}.crate.tar.gz" , name , version ) ) ;
188+ let krate_file_path = krate_download_dir. join ( format ! ( "{name }-{version }.crate.tar.gz" ) ) ;
189189 // don't download/extract if we already have done so
190190 if !krate_file_path. is_file ( ) {
191191 // create a file path to download and write the crate data into
@@ -205,7 +205,7 @@ impl CrateSource {
205205 Crate {
206206 version : version. clone ( ) ,
207207 name : name. clone ( ) ,
208- path : extract_dir. join ( format ! ( "{}-{}/" , name , version ) ) ,
208+ path : extract_dir. join ( format ! ( "{name }-{version }/" ) ) ,
209209 options : options. clone ( ) ,
210210 }
211211 } ,
@@ -218,12 +218,12 @@ impl CrateSource {
218218 let repo_path = {
219219 let mut repo_path = PathBuf :: from ( LINTCHECK_SOURCES ) ;
220220 // add a -git suffix in case we have the same crate from crates.io and a git repo
221- repo_path. push ( format ! ( "{}-git" , name ) ) ;
221+ repo_path. push ( format ! ( "{name }-git" ) ) ;
222222 repo_path
223223 } ;
224224 // clone the repo if we have not done so
225225 if !repo_path. is_dir ( ) {
226- println ! ( "Cloning {} and checking out {}" , url , commit ) ;
226+ println ! ( "Cloning {url } and checking out {commit}" ) ;
227227 if !Command :: new ( "git" )
228228 . arg ( "clone" )
229229 . arg ( url)
@@ -232,7 +232,7 @@ impl CrateSource {
232232 . expect ( "Failed to clone git repo!" )
233233 . success ( )
234234 {
235- eprintln ! ( "Failed to clone {} into {}" , url , repo_path. display( ) )
235+ eprintln ! ( "Failed to clone {url } into {}" , repo_path. display( ) )
236236 }
237237 }
238238 // check out the commit/branch/whatever
@@ -245,7 +245,7 @@ impl CrateSource {
245245 . expect ( "Failed to check out commit" )
246246 . success ( )
247247 {
248- eprintln ! ( "Failed to checkout {} of repo at {}" , commit , repo_path. display( ) )
248+ eprintln ! ( "Failed to checkout {commit } of repo at {}" , repo_path. display( ) )
249249 }
250250
251251 Crate {
@@ -261,11 +261,11 @@ impl CrateSource {
261261 // as a result of this filter.
262262 let dest_crate_root = PathBuf :: from ( LINTCHECK_SOURCES ) . join ( name) ;
263263 if dest_crate_root. exists ( ) {
264- println ! ( "Deleting existing directory at {:?}" , dest_crate_root ) ;
264+ println ! ( "Deleting existing directory at {dest_crate_root :?}" ) ;
265265 std:: fs:: remove_dir_all ( & dest_crate_root) . unwrap ( ) ;
266266 }
267267
268- println ! ( "Copying {:?} to {:?}" , path , dest_crate_root ) ;
268+ println ! ( "Copying {path :?} to {dest_crate_root :?}" ) ;
269269
270270 fn is_cache_dir ( entry : & DirEntry ) -> bool {
271271 std:: fs:: read ( entry. path ( ) . join ( "CACHEDIR.TAG" ) )
@@ -389,10 +389,7 @@ impl Crate {
389389
390390 let all_output = Command :: new ( & cargo_clippy_path)
391391 // use the looping index to create individual target dirs
392- . env (
393- "CARGO_TARGET_DIR" ,
394- shared_target_dir. join ( format ! ( "_{:?}" , thread_index) ) ,
395- )
392+ . env ( "CARGO_TARGET_DIR" , shared_target_dir. join ( format ! ( "_{thread_index:?}" ) ) )
396393 . args ( & cargo_clippy_args)
397394 . current_dir ( & self . path )
398395 . output ( )
@@ -422,8 +419,8 @@ impl Crate {
422419 {
423420 let subcrate = & stderr[ 63 ..] ;
424421 println ! (
425- "ERROR: failed to apply some suggetion to {} / to (sub)crate {}" ,
426- self . name, subcrate
422+ "ERROR: failed to apply some suggetion to {} / to (sub)crate {subcrate }" ,
423+ self . name
427424 ) ;
428425 }
429426 // fast path, we don't need the warnings anyway
@@ -459,7 +456,7 @@ fn read_crates(toml_path: &Path) -> (Vec<CrateSource>, RecursiveOptions) {
459456 let toml_content: String =
460457 std:: fs:: read_to_string ( toml_path) . unwrap_or_else ( |_| panic ! ( "Failed to read {}" , toml_path. display( ) ) ) ;
461458 let crate_list: SourceList =
462- toml:: from_str ( & toml_content) . unwrap_or_else ( |e| panic ! ( "Failed to parse {}: \n {}" , toml_path. display( ) , e ) ) ;
459+ toml:: from_str ( & toml_content) . unwrap_or_else ( |e| panic ! ( "Failed to parse {}: \n {e }" , toml_path. display( ) ) ) ;
463460 // parse the hashmap of the toml file into a list of crates
464461 let tomlcrates: Vec < TomlCrate > = crate_list. crates . into_values ( ) . collect ( ) ;
465462
@@ -498,7 +495,7 @@ fn read_crates(toml_path: &Path) -> (Vec<CrateSource>, RecursiveOptions) {
498495 if tk. versions . is_some ( ) && ( tk. git_url . is_some ( ) || tk. git_hash . is_some ( ) )
499496 || tk. git_hash . is_some ( ) != tk. git_url . is_some ( )
500497 {
501- eprintln ! ( "tomlkrate: {:?}" , tk ) ;
498+ eprintln ! ( "tomlkrate: {tk :?}" ) ;
502499 if tk. git_hash . is_some ( ) != tk. git_url . is_some ( ) {
503500 panic ! ( "Error: Encountered TomlCrate with only one of git_hash and git_url!" ) ;
504501 }
@@ -526,13 +523,13 @@ fn gather_stats(clippy_warnings: &[ClippyWarning]) -> (String, HashMap<&String,
526523 let mut stats: Vec < ( & & String , & usize ) > = counter. iter ( ) . map ( |( lint, count) | ( lint, count) ) . collect ( ) ;
527524 // sort by "000{count} {clippy::lintname}"
528525 // to not have a lint with 200 and 2 warnings take the same spot
529- stats. sort_by_key ( |( lint, count) | format ! ( "{:0>4}, {}" , count , lint ) ) ;
526+ stats. sort_by_key ( |( lint, count) | format ! ( "{count :0>4}, {lint}" ) ) ;
530527
531528 let mut header = String :: from ( "| lint | count |\n " ) ;
532529 header. push_str ( "| -------------------------------------------------- | ----- |\n " ) ;
533530 let stats_string = stats
534531 . iter ( )
535- . map ( |( lint, count) | format ! ( "| {:<50} | {:>4} |\n " , lint , count ) )
532+ . map ( |( lint, count) | format ! ( "| {lint :<50} | {count :>4} |\n " ) )
536533 . fold ( header, |mut table, line| {
537534 table. push_str ( & line) ;
538535 table
@@ -731,7 +728,7 @@ fn main() {
731728 write ! ( text, "{}" , all_msgs. join( "" ) ) . unwrap ( ) ;
732729 text. push_str ( "\n \n ### ICEs:\n " ) ;
733730 for ( cratename, msg) in ices. iter ( ) {
734- let _ = write ! ( text, "{}: '{}'" , cratename , msg ) ;
731+ let _ = write ! ( text, "{cratename }: '{msg }'" ) ;
735732 }
736733
737734 println ! ( "Writing logs to {}" , config. lintcheck_results_path. display( ) ) ;
@@ -795,7 +792,7 @@ fn print_stats(old_stats: HashMap<String, usize>, new_stats: HashMap<&String, us
795792 . iter ( )
796793 . filter ( |( new_key, _) | old_stats_deduped. get :: < str > ( new_key) . is_none ( ) )
797794 . for_each ( |( new_key, new_value) | {
798- println ! ( "{} 0 => {}" , new_key , new_value ) ;
795+ println ! ( "{new_key } 0 => {new_value}" ) ;
799796 } ) ;
800797
801798 // list all changed counts (key is in both maps but value differs)
@@ -804,7 +801,7 @@ fn print_stats(old_stats: HashMap<String, usize>, new_stats: HashMap<&String, us
804801 . filter ( |( new_key, _new_val) | old_stats_deduped. get :: < str > ( new_key) . is_some ( ) )
805802 . for_each ( |( new_key, new_val) | {
806803 let old_val = old_stats_deduped. get :: < str > ( new_key) . unwrap ( ) ;
807- println ! ( "{} {} => {}" , new_key , old_val , new_val ) ;
804+ println ! ( "{new_key } {old_val } => {new_val}" ) ;
808805 } ) ;
809806
810807 // list all gone counts (key is in old status but not in new stats)
@@ -813,7 +810,7 @@ fn print_stats(old_stats: HashMap<String, usize>, new_stats: HashMap<&String, us
813810 . filter ( |( old_key, _) | new_stats_deduped. get :: < & String > ( old_key) . is_none ( ) )
814811 . filter ( |( old_key, _) | lint_filter. is_empty ( ) || lint_filter. contains ( old_key) )
815812 . for_each ( |( old_key, old_value) | {
816- println ! ( "{} {} => 0" , old_key , old_value ) ;
813+ println ! ( "{old_key } {old_value } => 0" ) ;
817814 } ) ;
818815}
819816
0 commit comments