@@ -382,11 +382,11 @@ impl<'test> TestCx<'test> {
382
382
383
383
// if a test does not crash, consider it an error
384
384
if proc_res. status . success ( ) || matches ! ( proc_res. status. code( ) , Some ( 1 | 0 ) ) {
385
- self . fatal ( & format ! (
385
+ self . fatal (
386
386
"test no longer crashes/triggers ICE! Please give it a mearningful name, \
387
387
add a doc-comment to the start of the test explaining why it exists and \
388
- move it to tests/ui or wherever you see fit."
389
- ) ) ;
388
+ move it to tests/ui or wherever you see fit.",
389
+ ) ;
390
390
}
391
391
}
392
392
@@ -705,10 +705,10 @@ impl<'test> TestCx<'test> {
705
705
// since it is extensively used in the testsuite.
706
706
check_cfg. push_str ( "cfg(FALSE" ) ;
707
707
for revision in & self . props . revisions {
708
- check_cfg. push_str ( "," ) ;
709
- check_cfg. push_str ( & normalize_revision ( & revision) ) ;
708
+ check_cfg. push ( ',' ) ;
709
+ check_cfg. push_str ( & normalize_revision ( revision) ) ;
710
710
}
711
- check_cfg. push_str ( ")" ) ;
711
+ check_cfg. push ( ')' ) ;
712
712
713
713
cmd. args ( & [ "--check-cfg" , & check_cfg] ) ;
714
714
}
@@ -826,7 +826,7 @@ impl<'test> TestCx<'test> {
826
826
// Append the other `cdb-command:`s
827
827
for line in & dbg_cmds. commands {
828
828
script_str. push_str ( line) ;
829
- script_str. push_str ( " \n " ) ;
829
+ script_str. push ( '\n' ) ;
830
830
}
831
831
832
832
script_str. push_str ( "qq\n " ) ; // Quit the debugger (including remote debugger, if any)
@@ -1208,7 +1208,7 @@ impl<'test> TestCx<'test> {
1208
1208
// Append the other commands
1209
1209
for line in & dbg_cmds. commands {
1210
1210
script_str. push_str ( line) ;
1211
- script_str. push_str ( " \n " ) ;
1211
+ script_str. push ( '\n' ) ;
1212
1212
}
1213
1213
1214
1214
// Finally, quit the debugger
@@ -1258,7 +1258,7 @@ impl<'test> TestCx<'test> {
1258
1258
// Remove options that are either unwanted (-O) or may lead to duplicates due to RUSTFLAGS.
1259
1259
let options_to_remove = [ "-O" . to_owned ( ) , "-g" . to_owned ( ) , "--debuginfo" . to_owned ( ) ] ;
1260
1260
1261
- options. iter ( ) . filter ( |x| !options_to_remove. contains ( x) ) . map ( |x| x . clone ( ) ) . collect ( )
1261
+ options. iter ( ) . filter ( |x| !options_to_remove. contains ( x) ) . cloned ( ) . collect ( )
1262
1262
}
1263
1263
1264
1264
fn maybe_add_external_args ( & self , cmd : & mut Command , args : & Vec < String > ) {
@@ -2512,8 +2512,8 @@ impl<'test> TestCx<'test> {
2512
2512
// This works with both `--emit asm` (as default output name for the assembly)
2513
2513
// and `ptx-linker` because the latter can write output at requested location.
2514
2514
let output_path = self . output_base_name ( ) . with_extension ( extension) ;
2515
- let output_file = TargetLocation :: ThisFile ( output_path . clone ( ) ) ;
2516
- output_file
2515
+
2516
+ TargetLocation :: ThisFile ( output_path . clone ( ) )
2517
2517
}
2518
2518
}
2519
2519
@@ -2760,7 +2760,7 @@ impl<'test> TestCx<'test> {
2760
2760
for entry in walkdir:: WalkDir :: new ( dir) {
2761
2761
let entry = entry. expect ( "failed to read file" ) ;
2762
2762
if entry. file_type ( ) . is_file ( )
2763
- && entry. path ( ) . extension ( ) . and_then ( |p| p. to_str ( ) ) == Some ( "html" . into ( ) )
2763
+ && entry. path ( ) . extension ( ) . and_then ( |p| p. to_str ( ) ) == Some ( "html" )
2764
2764
{
2765
2765
let status =
2766
2766
Command :: new ( "tidy" ) . args ( & tidy_args) . arg ( entry. path ( ) ) . status ( ) . unwrap ( ) ;
@@ -2791,8 +2791,7 @@ impl<'test> TestCx<'test> {
2791
2791
& compare_dir,
2792
2792
self . config . verbose ,
2793
2793
|file_type, extension| {
2794
- file_type. is_file ( )
2795
- && ( extension == Some ( "html" . into ( ) ) || extension == Some ( "js" . into ( ) ) )
2794
+ file_type. is_file ( ) && ( extension == Some ( "html" ) || extension == Some ( "js" ) )
2796
2795
} ,
2797
2796
) {
2798
2797
return ;
@@ -2838,11 +2837,11 @@ impl<'test> TestCx<'test> {
2838
2837
}
2839
2838
match String :: from_utf8 ( line. clone ( ) ) {
2840
2839
Ok ( line) => {
2841
- if line. starts_with ( "+" ) {
2840
+ if line. starts_with ( '+' ) {
2842
2841
write ! ( & mut out, "{}" , line. green( ) ) . unwrap ( ) ;
2843
- } else if line. starts_with ( "-" ) {
2842
+ } else if line. starts_with ( '-' ) {
2844
2843
write ! ( & mut out, "{}" , line. red( ) ) . unwrap ( ) ;
2845
- } else if line. starts_with ( "@" ) {
2844
+ } else if line. starts_with ( '@' ) {
2846
2845
write ! ( & mut out, "{}" , line. blue( ) ) . unwrap ( ) ;
2847
2846
} else {
2848
2847
out. write_all ( line. as_bytes ( ) ) . unwrap ( ) ;
@@ -2915,7 +2914,7 @@ impl<'test> TestCx<'test> {
2915
2914
&& line. ends_with ( ';' )
2916
2915
{
2917
2916
if let Some ( ref mut other_files) = other_files {
2918
- other_files. push ( line. rsplit ( "mod " ) . next ( ) . unwrap ( ) . replace ( ";" , "" ) ) ;
2917
+ other_files. push ( line. rsplit ( "mod " ) . next ( ) . unwrap ( ) . replace ( ';' , "" ) ) ;
2919
2918
}
2920
2919
None
2921
2920
} else {
@@ -3147,7 +3146,7 @@ impl<'test> TestCx<'test> {
3147
3146
let mut string = String :: new ( ) ;
3148
3147
for cgu in cgus {
3149
3148
string. push_str ( & cgu[ ..] ) ;
3150
- string. push_str ( " " ) ;
3149
+ string. push ( ' ' ) ;
3151
3150
}
3152
3151
3153
3152
string
@@ -3180,10 +3179,7 @@ impl<'test> TestCx<'test> {
3180
3179
// CGUs joined with "--". This function splits such composite CGU names
3181
3180
// and handles each component individually.
3182
3181
fn remove_crate_disambiguators_from_set_of_cgu_names ( cgus : & str ) -> String {
3183
- cgus. split ( "--" )
3184
- . map ( |cgu| remove_crate_disambiguator_from_cgu ( cgu) )
3185
- . collect :: < Vec < _ > > ( )
3186
- . join ( "--" )
3182
+ cgus. split ( "--" ) . map ( remove_crate_disambiguator_from_cgu) . collect :: < Vec < _ > > ( ) . join ( "--" )
3187
3183
}
3188
3184
}
3189
3185
@@ -3365,7 +3361,7 @@ impl<'test> TestCx<'test> {
3365
3361
// endif
3366
3362
}
3367
3363
3368
- if self . config . target . contains ( "msvc" ) && self . config . cc != "" {
3364
+ if self . config . target . contains ( "msvc" ) && ! self . config . cc . is_empty ( ) {
3369
3365
// We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
3370
3366
// and that `lib.exe` lives next to it.
3371
3367
let lib = Path :: new ( & self . config . cc ) . parent ( ) . unwrap ( ) . join ( "lib.exe" ) ;
@@ -3647,7 +3643,7 @@ impl<'test> TestCx<'test> {
3647
3643
// endif
3648
3644
}
3649
3645
3650
- if self . config . target . contains ( "msvc" ) && self . config . cc != "" {
3646
+ if self . config . target . contains ( "msvc" ) && ! self . config . cc . is_empty ( ) {
3651
3647
// We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
3652
3648
// and that `lib.exe` lives next to it.
3653
3649
let lib = Path :: new ( & self . config . cc ) . parent ( ) . unwrap ( ) . join ( "lib.exe" ) ;
@@ -3838,7 +3834,7 @@ impl<'test> TestCx<'test> {
3838
3834
&& !self . props . dont_check_compiler_stderr
3839
3835
{
3840
3836
self . fatal_proc_rec (
3841
- & format ! ( "compiler output got truncated, cannot compare with reference file" ) ,
3837
+ "compiler output got truncated, cannot compare with reference file" ,
3842
3838
& proc_res,
3843
3839
) ;
3844
3840
}
@@ -4019,8 +4015,8 @@ impl<'test> TestCx<'test> {
4019
4015
crate_name. to_str ( ) . expect ( "crate name implies file name must be valid UTF-8" ) ;
4020
4016
// replace `a.foo` -> `a__foo` for crate name purposes.
4021
4017
// replace `revision-name-with-dashes` -> `revision_name_with_underscore`
4022
- let crate_name = crate_name. replace ( "." , "__" ) ;
4023
- let crate_name = crate_name. replace ( "-" , "_" ) ;
4018
+ let crate_name = crate_name. replace ( '.' , "__" ) ;
4019
+ let crate_name = crate_name. replace ( '-' , "_" ) ;
4024
4020
rustc. arg ( "--crate-name" ) ;
4025
4021
rustc. arg ( crate_name) ;
4026
4022
}
@@ -4068,7 +4064,7 @@ impl<'test> TestCx<'test> {
4068
4064
fn check_mir_dump ( & self , test_info : MiroptTest ) {
4069
4065
let test_dir = self . testpaths . file . parent ( ) . unwrap ( ) ;
4070
4066
let test_crate =
4071
- self . testpaths . file . file_stem ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . replace ( "-" , "_" ) ;
4067
+ self . testpaths . file . file_stem ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . replace ( '-' , "_" ) ;
4072
4068
4073
4069
let MiroptTest { run_filecheck, suffix, files, passes : _ } = test_info;
4074
4070
0 commit comments