@@ -374,11 +374,11 @@ impl<'test> TestCx<'test> {
374
374
375
375
// if a test does not crash, consider it an error
376
376
if proc_res. status . success ( ) || matches ! ( proc_res. status. code( ) , Some ( 1 | 0 ) ) {
377
- self . fatal ( & format ! (
377
+ self . fatal (
378
378
"test no longer crashes/triggers ICE! Please give it a mearningful name, \
379
379
add a doc-comment to the start of the test explaining why it exists and \
380
- move it to tests/ui or wherever you see fit."
381
- ) ) ;
380
+ move it to tests/ui or wherever you see fit.",
381
+ ) ;
382
382
}
383
383
}
384
384
@@ -697,10 +697,10 @@ impl<'test> TestCx<'test> {
697
697
// since it is extensively used in the testsuite.
698
698
check_cfg. push_str ( "cfg(FALSE" ) ;
699
699
for revision in & self . props . revisions {
700
- check_cfg. push_str ( "," ) ;
701
- check_cfg. push_str ( & normalize_revision ( & revision) ) ;
700
+ check_cfg. push ( ',' ) ;
701
+ check_cfg. push_str ( & normalize_revision ( revision) ) ;
702
702
}
703
- check_cfg. push_str ( ")" ) ;
703
+ check_cfg. push ( ')' ) ;
704
704
705
705
cmd. args ( & [ "--check-cfg" , & check_cfg] ) ;
706
706
}
@@ -818,7 +818,7 @@ impl<'test> TestCx<'test> {
818
818
// Append the other `cdb-command:`s
819
819
for line in & dbg_cmds. commands {
820
820
script_str. push_str ( line) ;
821
- script_str. push_str ( " \n " ) ;
821
+ script_str. push ( '\n' ) ;
822
822
}
823
823
824
824
script_str. push_str ( "qq\n " ) ; // Quit the debugger (including remote debugger, if any)
@@ -1200,7 +1200,7 @@ impl<'test> TestCx<'test> {
1200
1200
// Append the other commands
1201
1201
for line in & dbg_cmds. commands {
1202
1202
script_str. push_str ( line) ;
1203
- script_str. push_str ( " \n " ) ;
1203
+ script_str. push ( '\n' ) ;
1204
1204
}
1205
1205
1206
1206
// Finally, quit the debugger
@@ -1250,7 +1250,7 @@ impl<'test> TestCx<'test> {
1250
1250
// Remove options that are either unwanted (-O) or may lead to duplicates due to RUSTFLAGS.
1251
1251
let options_to_remove = [ "-O" . to_owned ( ) , "-g" . to_owned ( ) , "--debuginfo" . to_owned ( ) ] ;
1252
1252
1253
- options. iter ( ) . filter ( |x| !options_to_remove. contains ( x) ) . map ( |x| x . clone ( ) ) . collect ( )
1253
+ options. iter ( ) . filter ( |x| !options_to_remove. contains ( x) ) . cloned ( ) . collect ( )
1254
1254
}
1255
1255
1256
1256
fn maybe_add_external_args ( & self , cmd : & mut Command , args : & Vec < String > ) {
@@ -2504,8 +2504,8 @@ impl<'test> TestCx<'test> {
2504
2504
// This works with both `--emit asm` (as default output name for the assembly)
2505
2505
// and `ptx-linker` because the latter can write output at requested location.
2506
2506
let output_path = self . output_base_name ( ) . with_extension ( extension) ;
2507
- let output_file = TargetLocation :: ThisFile ( output_path . clone ( ) ) ;
2508
- output_file
2507
+
2508
+ TargetLocation :: ThisFile ( output_path . clone ( ) )
2509
2509
}
2510
2510
}
2511
2511
@@ -2752,7 +2752,7 @@ impl<'test> TestCx<'test> {
2752
2752
for entry in walkdir:: WalkDir :: new ( dir) {
2753
2753
let entry = entry. expect ( "failed to read file" ) ;
2754
2754
if entry. file_type ( ) . is_file ( )
2755
- && entry. path ( ) . extension ( ) . and_then ( |p| p. to_str ( ) ) == Some ( "html" . into ( ) )
2755
+ && entry. path ( ) . extension ( ) . and_then ( |p| p. to_str ( ) ) == Some ( "html" )
2756
2756
{
2757
2757
let status =
2758
2758
Command :: new ( "tidy" ) . args ( & tidy_args) . arg ( entry. path ( ) ) . status ( ) . unwrap ( ) ;
@@ -2783,8 +2783,7 @@ impl<'test> TestCx<'test> {
2783
2783
& compare_dir,
2784
2784
self . config . verbose ,
2785
2785
|file_type, extension| {
2786
- file_type. is_file ( )
2787
- && ( extension == Some ( "html" . into ( ) ) || extension == Some ( "js" . into ( ) ) )
2786
+ file_type. is_file ( ) && ( extension == Some ( "html" ) || extension == Some ( "js" ) )
2788
2787
} ,
2789
2788
) {
2790
2789
return ;
@@ -2830,11 +2829,11 @@ impl<'test> TestCx<'test> {
2830
2829
}
2831
2830
match String :: from_utf8 ( line. clone ( ) ) {
2832
2831
Ok ( line) => {
2833
- if line. starts_with ( "+" ) {
2832
+ if line. starts_with ( '+' ) {
2834
2833
write ! ( & mut out, "{}" , line. green( ) ) . unwrap ( ) ;
2835
- } else if line. starts_with ( "-" ) {
2834
+ } else if line. starts_with ( '-' ) {
2836
2835
write ! ( & mut out, "{}" , line. red( ) ) . unwrap ( ) ;
2837
- } else if line. starts_with ( "@" ) {
2836
+ } else if line. starts_with ( '@' ) {
2838
2837
write ! ( & mut out, "{}" , line. blue( ) ) . unwrap ( ) ;
2839
2838
} else {
2840
2839
out. write_all ( line. as_bytes ( ) ) . unwrap ( ) ;
@@ -2907,7 +2906,7 @@ impl<'test> TestCx<'test> {
2907
2906
&& line. ends_with ( ';' )
2908
2907
{
2909
2908
if let Some ( ref mut other_files) = other_files {
2910
- other_files. push ( line. rsplit ( "mod " ) . next ( ) . unwrap ( ) . replace ( ";" , "" ) ) ;
2909
+ other_files. push ( line. rsplit ( "mod " ) . next ( ) . unwrap ( ) . replace ( ';' , "" ) ) ;
2911
2910
}
2912
2911
None
2913
2912
} else {
@@ -3139,7 +3138,7 @@ impl<'test> TestCx<'test> {
3139
3138
let mut string = String :: new ( ) ;
3140
3139
for cgu in cgus {
3141
3140
string. push_str ( & cgu[ ..] ) ;
3142
- string. push_str ( " " ) ;
3141
+ string. push ( ' ' ) ;
3143
3142
}
3144
3143
3145
3144
string
@@ -3172,10 +3171,7 @@ impl<'test> TestCx<'test> {
3172
3171
// CGUs joined with "--". This function splits such composite CGU names
3173
3172
// and handles each component individually.
3174
3173
fn remove_crate_disambiguators_from_set_of_cgu_names ( cgus : & str ) -> String {
3175
- cgus. split ( "--" )
3176
- . map ( |cgu| remove_crate_disambiguator_from_cgu ( cgu) )
3177
- . collect :: < Vec < _ > > ( )
3178
- . join ( "--" )
3174
+ cgus. split ( "--" ) . map ( remove_crate_disambiguator_from_cgu) . collect :: < Vec < _ > > ( ) . join ( "--" )
3179
3175
}
3180
3176
}
3181
3177
@@ -3357,7 +3353,7 @@ impl<'test> TestCx<'test> {
3357
3353
// endif
3358
3354
}
3359
3355
3360
- if self . config . target . contains ( "msvc" ) && self . config . cc != "" {
3356
+ if self . config . target . contains ( "msvc" ) && ! self . config . cc . is_empty ( ) {
3361
3357
// We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
3362
3358
// and that `lib.exe` lives next to it.
3363
3359
let lib = Path :: new ( & self . config . cc ) . parent ( ) . unwrap ( ) . join ( "lib.exe" ) ;
@@ -3639,7 +3635,7 @@ impl<'test> TestCx<'test> {
3639
3635
// endif
3640
3636
}
3641
3637
3642
- if self . config . target . contains ( "msvc" ) && self . config . cc != "" {
3638
+ if self . config . target . contains ( "msvc" ) && ! self . config . cc . is_empty ( ) {
3643
3639
// We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
3644
3640
// and that `lib.exe` lives next to it.
3645
3641
let lib = Path :: new ( & self . config . cc ) . parent ( ) . unwrap ( ) . join ( "lib.exe" ) ;
@@ -3830,7 +3826,7 @@ impl<'test> TestCx<'test> {
3830
3826
&& !self . props . dont_check_compiler_stderr
3831
3827
{
3832
3828
self . fatal_proc_rec (
3833
- & format ! ( "compiler output got truncated, cannot compare with reference file" ) ,
3829
+ "compiler output got truncated, cannot compare with reference file" ,
3834
3830
& proc_res,
3835
3831
) ;
3836
3832
}
@@ -4011,8 +4007,8 @@ impl<'test> TestCx<'test> {
4011
4007
crate_name. to_str ( ) . expect ( "crate name implies file name must be valid UTF-8" ) ;
4012
4008
// replace `a.foo` -> `a__foo` for crate name purposes.
4013
4009
// replace `revision-name-with-dashes` -> `revision_name_with_underscore`
4014
- let crate_name = crate_name. replace ( "." , "__" ) ;
4015
- let crate_name = crate_name. replace ( "-" , "_" ) ;
4010
+ let crate_name = crate_name. replace ( '.' , "__" ) ;
4011
+ let crate_name = crate_name. replace ( '-' , "_" ) ;
4016
4012
rustc. arg ( "--crate-name" ) ;
4017
4013
rustc. arg ( crate_name) ;
4018
4014
}
@@ -4060,7 +4056,7 @@ impl<'test> TestCx<'test> {
4060
4056
fn check_mir_dump ( & self , test_info : MiroptTest ) {
4061
4057
let test_dir = self . testpaths . file . parent ( ) . unwrap ( ) ;
4062
4058
let test_crate =
4063
- self . testpaths . file . file_stem ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . replace ( "-" , "_" ) ;
4059
+ self . testpaths . file . file_stem ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . replace ( '-' , "_" ) ;
4064
4060
4065
4061
let MiroptTest { run_filecheck, suffix, files, passes : _ } = test_info;
4066
4062
0 commit comments