@@ -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 > ) {
@@ -2498,8 +2498,8 @@ impl<'test> TestCx<'test> {
2498
2498
// This works with both `--emit asm` (as default output name for the assembly)
2499
2499
// and `ptx-linker` because the latter can write output at requested location.
2500
2500
let output_path = self . output_base_name ( ) . with_extension ( extension) ;
2501
- let output_file = TargetLocation :: ThisFile ( output_path . clone ( ) ) ;
2502
- output_file
2501
+
2502
+ TargetLocation :: ThisFile ( output_path . clone ( ) )
2503
2503
}
2504
2504
}
2505
2505
@@ -2746,7 +2746,7 @@ impl<'test> TestCx<'test> {
2746
2746
for entry in walkdir:: WalkDir :: new ( dir) {
2747
2747
let entry = entry. expect ( "failed to read file" ) ;
2748
2748
if entry. file_type ( ) . is_file ( )
2749
- && entry. path ( ) . extension ( ) . and_then ( |p| p. to_str ( ) ) == Some ( "html" . into ( ) )
2749
+ && entry. path ( ) . extension ( ) . and_then ( |p| p. to_str ( ) ) == Some ( "html" )
2750
2750
{
2751
2751
let status =
2752
2752
Command :: new ( "tidy" ) . args ( & tidy_args) . arg ( entry. path ( ) ) . status ( ) . unwrap ( ) ;
@@ -2777,8 +2777,7 @@ impl<'test> TestCx<'test> {
2777
2777
& compare_dir,
2778
2778
self . config . verbose ,
2779
2779
|file_type, extension| {
2780
- file_type. is_file ( )
2781
- && ( extension == Some ( "html" . into ( ) ) || extension == Some ( "js" . into ( ) ) )
2780
+ file_type. is_file ( ) && ( extension == Some ( "html" ) || extension == Some ( "js" ) )
2782
2781
} ,
2783
2782
) {
2784
2783
return ;
@@ -2824,11 +2823,11 @@ impl<'test> TestCx<'test> {
2824
2823
}
2825
2824
match String :: from_utf8 ( line. clone ( ) ) {
2826
2825
Ok ( line) => {
2827
- if line. starts_with ( "+" ) {
2826
+ if line. starts_with ( '+' ) {
2828
2827
write ! ( & mut out, "{}" , line. green( ) ) . unwrap ( ) ;
2829
- } else if line. starts_with ( "-" ) {
2828
+ } else if line. starts_with ( '-' ) {
2830
2829
write ! ( & mut out, "{}" , line. red( ) ) . unwrap ( ) ;
2831
- } else if line. starts_with ( "@" ) {
2830
+ } else if line. starts_with ( '@' ) {
2832
2831
write ! ( & mut out, "{}" , line. blue( ) ) . unwrap ( ) ;
2833
2832
} else {
2834
2833
out. write_all ( line. as_bytes ( ) ) . unwrap ( ) ;
@@ -2901,7 +2900,7 @@ impl<'test> TestCx<'test> {
2901
2900
&& line. ends_with ( ';' )
2902
2901
{
2903
2902
if let Some ( ref mut other_files) = other_files {
2904
- other_files. push ( line. rsplit ( "mod " ) . next ( ) . unwrap ( ) . replace ( ";" , "" ) ) ;
2903
+ other_files. push ( line. rsplit ( "mod " ) . next ( ) . unwrap ( ) . replace ( ';' , "" ) ) ;
2905
2904
}
2906
2905
None
2907
2906
} else {
@@ -3133,7 +3132,7 @@ impl<'test> TestCx<'test> {
3133
3132
let mut string = String :: new ( ) ;
3134
3133
for cgu in cgus {
3135
3134
string. push_str ( & cgu[ ..] ) ;
3136
- string. push_str ( " " ) ;
3135
+ string. push ( ' ' ) ;
3137
3136
}
3138
3137
3139
3138
string
@@ -3166,10 +3165,7 @@ impl<'test> TestCx<'test> {
3166
3165
// CGUs joined with "--". This function splits such composite CGU names
3167
3166
// and handles each component individually.
3168
3167
fn remove_crate_disambiguators_from_set_of_cgu_names ( cgus : & str ) -> String {
3169
- cgus. split ( "--" )
3170
- . map ( |cgu| remove_crate_disambiguator_from_cgu ( cgu) )
3171
- . collect :: < Vec < _ > > ( )
3172
- . join ( "--" )
3168
+ cgus. split ( "--" ) . map ( remove_crate_disambiguator_from_cgu) . collect :: < Vec < _ > > ( ) . join ( "--" )
3173
3169
}
3174
3170
}
3175
3171
@@ -3351,7 +3347,7 @@ impl<'test> TestCx<'test> {
3351
3347
// endif
3352
3348
}
3353
3349
3354
- if self . config . target . contains ( "msvc" ) && self . config . cc != "" {
3350
+ if self . config . target . contains ( "msvc" ) && ! self . config . cc . is_empty ( ) {
3355
3351
// We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
3356
3352
// and that `lib.exe` lives next to it.
3357
3353
let lib = Path :: new ( & self . config . cc ) . parent ( ) . unwrap ( ) . join ( "lib.exe" ) ;
@@ -3629,7 +3625,7 @@ impl<'test> TestCx<'test> {
3629
3625
// endif
3630
3626
}
3631
3627
3632
- if self . config . target . contains ( "msvc" ) && self . config . cc != "" {
3628
+ if self . config . target . contains ( "msvc" ) && ! self . config . cc . is_empty ( ) {
3633
3629
// We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
3634
3630
// and that `lib.exe` lives next to it.
3635
3631
let lib = Path :: new ( & self . config . cc ) . parent ( ) . unwrap ( ) . join ( "lib.exe" ) ;
@@ -3820,7 +3816,7 @@ impl<'test> TestCx<'test> {
3820
3816
&& !self . props . dont_check_compiler_stderr
3821
3817
{
3822
3818
self . fatal_proc_rec (
3823
- & format ! ( "compiler output got truncated, cannot compare with reference file" ) ,
3819
+ "compiler output got truncated, cannot compare with reference file" ,
3824
3820
& proc_res,
3825
3821
) ;
3826
3822
}
@@ -4001,8 +3997,8 @@ impl<'test> TestCx<'test> {
4001
3997
crate_name. to_str ( ) . expect ( "crate name implies file name must be valid UTF-8" ) ;
4002
3998
// replace `a.foo` -> `a__foo` for crate name purposes.
4003
3999
// replace `revision-name-with-dashes` -> `revision_name_with_underscore`
4004
- let crate_name = crate_name. replace ( "." , "__" ) ;
4005
- let crate_name = crate_name. replace ( "-" , "_" ) ;
4000
+ let crate_name = crate_name. replace ( '.' , "__" ) ;
4001
+ let crate_name = crate_name. replace ( '-' , "_" ) ;
4006
4002
rustc. arg ( "--crate-name" ) ;
4007
4003
rustc. arg ( crate_name) ;
4008
4004
}
@@ -4050,7 +4046,7 @@ impl<'test> TestCx<'test> {
4050
4046
fn check_mir_dump ( & self , test_info : MiroptTest ) {
4051
4047
let test_dir = self . testpaths . file . parent ( ) . unwrap ( ) ;
4052
4048
let test_crate =
4053
- self . testpaths . file . file_stem ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . replace ( "-" , "_" ) ;
4049
+ self . testpaths . file . file_stem ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . replace ( '-' , "_" ) ;
4054
4050
4055
4051
let MiroptTest { run_filecheck, suffix, files, passes : _ } = test_info;
4056
4052
0 commit comments