@@ -144,12 +144,12 @@ impl ClippyWarning {
144
144
}
145
145
146
146
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) ;
148
148
let _ = write ! ( output, r#" | `{:<50}` | "{}" |"# , self . lint_type, self . message) ;
149
149
output. push ( '\n' ) ;
150
150
output
151
151
} else {
152
- format ! ( "{} {} \" {}\" \n " , file_with_pos , self . lint_type, self . message)
152
+ format ! ( "{file_with_pos } {} \" {}\" \n " , self . lint_type, self . message)
153
153
}
154
154
}
155
155
}
@@ -161,10 +161,10 @@ fn get(path: &str) -> Result<ureq::Response, ureq::Error> {
161
161
match ureq:: get ( path) . call ( ) {
162
162
Ok ( res) => return Ok ( res) ,
163
163
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}" ) ,
165
165
Err ( e) => return Err ( e) ,
166
166
}
167
- eprintln ! ( "retrying in {} seconds..." , retries ) ;
167
+ eprintln ! ( "retrying in {retries } seconds..." ) ;
168
168
thread:: sleep ( Duration :: from_secs ( retries as u64 ) ) ;
169
169
retries += 1 ;
170
170
}
@@ -181,11 +181,11 @@ impl CrateSource {
181
181
let krate_download_dir = PathBuf :: from ( LINTCHECK_DOWNLOADS ) ;
182
182
183
183
// 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}" ) ;
186
186
create_dirs ( & krate_download_dir, & extract_dir) ;
187
187
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" ) ) ;
189
189
// don't download/extract if we already have done so
190
190
if !krate_file_path. is_file ( ) {
191
191
// create a file path to download and write the crate data into
@@ -205,7 +205,7 @@ impl CrateSource {
205
205
Crate {
206
206
version : version. clone ( ) ,
207
207
name : name. clone ( ) ,
208
- path : extract_dir. join ( format ! ( "{}-{}/" , name , version ) ) ,
208
+ path : extract_dir. join ( format ! ( "{name }-{version }/" ) ) ,
209
209
options : options. clone ( ) ,
210
210
}
211
211
} ,
@@ -218,12 +218,12 @@ impl CrateSource {
218
218
let repo_path = {
219
219
let mut repo_path = PathBuf :: from ( LINTCHECK_SOURCES ) ;
220
220
// 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" ) ) ;
222
222
repo_path
223
223
} ;
224
224
// clone the repo if we have not done so
225
225
if !repo_path. is_dir ( ) {
226
- println ! ( "Cloning {} and checking out {}" , url , commit ) ;
226
+ println ! ( "Cloning {url } and checking out {commit}" ) ;
227
227
if !Command :: new ( "git" )
228
228
. arg ( "clone" )
229
229
. arg ( url)
@@ -232,7 +232,7 @@ impl CrateSource {
232
232
. expect ( "Failed to clone git repo!" )
233
233
. success ( )
234
234
{
235
- eprintln ! ( "Failed to clone {} into {}" , url , repo_path. display( ) )
235
+ eprintln ! ( "Failed to clone {url } into {}" , repo_path. display( ) )
236
236
}
237
237
}
238
238
// check out the commit/branch/whatever
@@ -245,7 +245,7 @@ impl CrateSource {
245
245
. expect ( "Failed to check out commit" )
246
246
. success ( )
247
247
{
248
- eprintln ! ( "Failed to checkout {} of repo at {}" , commit , repo_path. display( ) )
248
+ eprintln ! ( "Failed to checkout {commit } of repo at {}" , repo_path. display( ) )
249
249
}
250
250
251
251
Crate {
@@ -261,11 +261,11 @@ impl CrateSource {
261
261
// as a result of this filter.
262
262
let dest_crate_root = PathBuf :: from ( LINTCHECK_SOURCES ) . join ( name) ;
263
263
if dest_crate_root. exists ( ) {
264
- println ! ( "Deleting existing directory at {:?}" , dest_crate_root ) ;
264
+ println ! ( "Deleting existing directory at {dest_crate_root :?}" ) ;
265
265
std:: fs:: remove_dir_all ( & dest_crate_root) . unwrap ( ) ;
266
266
}
267
267
268
- println ! ( "Copying {:?} to {:?}" , path , dest_crate_root ) ;
268
+ println ! ( "Copying {path :?} to {dest_crate_root :?}" ) ;
269
269
270
270
fn is_cache_dir ( entry : & DirEntry ) -> bool {
271
271
std:: fs:: read ( entry. path ( ) . join ( "CACHEDIR.TAG" ) )
@@ -389,10 +389,7 @@ impl Crate {
389
389
390
390
let all_output = Command :: new ( & cargo_clippy_path)
391
391
// 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:?}" ) ) )
396
393
. args ( & cargo_clippy_args)
397
394
. current_dir ( & self . path )
398
395
. output ( )
@@ -422,8 +419,8 @@ impl Crate {
422
419
{
423
420
let subcrate = & stderr[ 63 ..] ;
424
421
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
427
424
) ;
428
425
}
429
426
// fast path, we don't need the warnings anyway
@@ -459,7 +456,7 @@ fn read_crates(toml_path: &Path) -> (Vec<CrateSource>, RecursiveOptions) {
459
456
let toml_content: String =
460
457
std:: fs:: read_to_string ( toml_path) . unwrap_or_else ( |_| panic ! ( "Failed to read {}" , toml_path. display( ) ) ) ;
461
458
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( ) ) ) ;
463
460
// parse the hashmap of the toml file into a list of crates
464
461
let tomlcrates: Vec < TomlCrate > = crate_list. crates . into_values ( ) . collect ( ) ;
465
462
@@ -498,7 +495,7 @@ fn read_crates(toml_path: &Path) -> (Vec<CrateSource>, RecursiveOptions) {
498
495
if tk. versions . is_some ( ) && ( tk. git_url . is_some ( ) || tk. git_hash . is_some ( ) )
499
496
|| tk. git_hash . is_some ( ) != tk. git_url . is_some ( )
500
497
{
501
- eprintln ! ( "tomlkrate: {:?}" , tk ) ;
498
+ eprintln ! ( "tomlkrate: {tk :?}" ) ;
502
499
if tk. git_hash . is_some ( ) != tk. git_url . is_some ( ) {
503
500
panic ! ( "Error: Encountered TomlCrate with only one of git_hash and git_url!" ) ;
504
501
}
@@ -526,13 +523,13 @@ fn gather_stats(clippy_warnings: &[ClippyWarning]) -> (String, HashMap<&String,
526
523
let mut stats: Vec < ( & & String , & usize ) > = counter. iter ( ) . map ( |( lint, count) | ( lint, count) ) . collect ( ) ;
527
524
// sort by "000{count} {clippy::lintname}"
528
525
// 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}" ) ) ;
530
527
531
528
let mut header = String :: from ( "| lint | count |\n " ) ;
532
529
header. push_str ( "| -------------------------------------------------- | ----- |\n " ) ;
533
530
let stats_string = stats
534
531
. iter ( )
535
- . map ( |( lint, count) | format ! ( "| {:<50} | {:>4} |\n " , lint , count ) )
532
+ . map ( |( lint, count) | format ! ( "| {lint :<50} | {count :>4} |\n " ) )
536
533
. fold ( header, |mut table, line| {
537
534
table. push_str ( & line) ;
538
535
table
@@ -731,7 +728,7 @@ fn main() {
731
728
write ! ( text, "{}" , all_msgs. join( "" ) ) . unwrap ( ) ;
732
729
text. push_str ( "\n \n ### ICEs:\n " ) ;
733
730
for ( cratename, msg) in ices. iter ( ) {
734
- let _ = write ! ( text, "{}: '{}'" , cratename , msg ) ;
731
+ let _ = write ! ( text, "{cratename }: '{msg }'" ) ;
735
732
}
736
733
737
734
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
795
792
. iter ( )
796
793
. filter ( |( new_key, _) | old_stats_deduped. get :: < str > ( new_key) . is_none ( ) )
797
794
. for_each ( |( new_key, new_value) | {
798
- println ! ( "{} 0 => {}" , new_key , new_value ) ;
795
+ println ! ( "{new_key } 0 => {new_value}" ) ;
799
796
} ) ;
800
797
801
798
// 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
804
801
. filter ( |( new_key, _new_val) | old_stats_deduped. get :: < str > ( new_key) . is_some ( ) )
805
802
. for_each ( |( new_key, new_val) | {
806
803
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}" ) ;
808
805
} ) ;
809
806
810
807
// 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
813
810
. filter ( |( old_key, _) | new_stats_deduped. get :: < & String > ( old_key) . is_none ( ) )
814
811
. filter ( |( old_key, _) | lint_filter. is_empty ( ) || lint_filter. contains ( old_key) )
815
812
. for_each ( |( old_key, old_value) | {
816
- println ! ( "{} {} => 0" , old_key , old_value ) ;
813
+ println ! ( "{old_key } {old_value } => 0" ) ;
817
814
} ) ;
818
815
}
819
816
0 commit comments