@@ -382,11 +382,11 @@ impl<'test> TestCx<'test> {
382382
383383 // if a test does not crash, consider it an error
384384 if proc_res. status . success ( ) || matches ! ( proc_res. status. code( ) , Some ( 1 | 0 ) ) {
385- self . fatal ( & format ! (
385+ self . fatal (
386386 "test no longer crashes/triggers ICE! Please give it a mearningful name, \
387387 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+ ) ;
390390 }
391391 }
392392
@@ -705,10 +705,10 @@ impl<'test> TestCx<'test> {
705705 // since it is extensively used in the testsuite.
706706 check_cfg. push_str ( "cfg(FALSE" ) ;
707707 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) ) ;
710710 }
711- check_cfg. push_str ( ")" ) ;
711+ check_cfg. push ( ')' ) ;
712712
713713 cmd. args ( & [ "--check-cfg" , & check_cfg] ) ;
714714 }
@@ -826,7 +826,7 @@ impl<'test> TestCx<'test> {
826826 // Append the other `cdb-command:`s
827827 for line in & dbg_cmds. commands {
828828 script_str. push_str ( line) ;
829- script_str. push_str ( " \n " ) ;
829+ script_str. push ( '\n' ) ;
830830 }
831831
832832 script_str. push_str ( "qq\n " ) ; // Quit the debugger (including remote debugger, if any)
@@ -1208,7 +1208,7 @@ impl<'test> TestCx<'test> {
12081208 // Append the other commands
12091209 for line in & dbg_cmds. commands {
12101210 script_str. push_str ( line) ;
1211- script_str. push_str ( " \n " ) ;
1211+ script_str. push ( '\n' ) ;
12121212 }
12131213
12141214 // Finally, quit the debugger
@@ -1258,7 +1258,7 @@ impl<'test> TestCx<'test> {
12581258 // Remove options that are either unwanted (-O) or may lead to duplicates due to RUSTFLAGS.
12591259 let options_to_remove = [ "-O" . to_owned ( ) , "-g" . to_owned ( ) , "--debuginfo" . to_owned ( ) ] ;
12601260
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 ( )
12621262 }
12631263
12641264 fn maybe_add_external_args ( & self , cmd : & mut Command , args : & Vec < String > ) {
@@ -2512,8 +2512,8 @@ impl<'test> TestCx<'test> {
25122512 // This works with both `--emit asm` (as default output name for the assembly)
25132513 // and `ptx-linker` because the latter can write output at requested location.
25142514 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 ( ) )
25172517 }
25182518 }
25192519
@@ -2760,7 +2760,7 @@ impl<'test> TestCx<'test> {
27602760 for entry in walkdir:: WalkDir :: new ( dir) {
27612761 let entry = entry. expect ( "failed to read file" ) ;
27622762 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" )
27642764 {
27652765 let status =
27662766 Command :: new ( "tidy" ) . args ( & tidy_args) . arg ( entry. path ( ) ) . status ( ) . unwrap ( ) ;
@@ -2791,8 +2791,7 @@ impl<'test> TestCx<'test> {
27912791 & compare_dir,
27922792 self . config . verbose ,
27932793 |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" ) )
27962795 } ,
27972796 ) {
27982797 return ;
@@ -2838,11 +2837,11 @@ impl<'test> TestCx<'test> {
28382837 }
28392838 match String :: from_utf8 ( line. clone ( ) ) {
28402839 Ok ( line) => {
2841- if line. starts_with ( "+" ) {
2840+ if line. starts_with ( '+' ) {
28422841 write ! ( & mut out, "{}" , line. green( ) ) . unwrap ( ) ;
2843- } else if line. starts_with ( "-" ) {
2842+ } else if line. starts_with ( '-' ) {
28442843 write ! ( & mut out, "{}" , line. red( ) ) . unwrap ( ) ;
2845- } else if line. starts_with ( "@" ) {
2844+ } else if line. starts_with ( '@' ) {
28462845 write ! ( & mut out, "{}" , line. blue( ) ) . unwrap ( ) ;
28472846 } else {
28482847 out. write_all ( line. as_bytes ( ) ) . unwrap ( ) ;
@@ -2915,7 +2914,7 @@ impl<'test> TestCx<'test> {
29152914 && line. ends_with ( ';' )
29162915 {
29172916 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 ( ';' , "" ) ) ;
29192918 }
29202919 None
29212920 } else {
@@ -3147,7 +3146,7 @@ impl<'test> TestCx<'test> {
31473146 let mut string = String :: new ( ) ;
31483147 for cgu in cgus {
31493148 string. push_str ( & cgu[ ..] ) ;
3150- string. push_str ( " " ) ;
3149+ string. push ( ' ' ) ;
31513150 }
31523151
31533152 string
@@ -3180,10 +3179,7 @@ impl<'test> TestCx<'test> {
31803179 // CGUs joined with "--". This function splits such composite CGU names
31813180 // and handles each component individually.
31823181 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 ( "--" )
31873183 }
31883184 }
31893185
@@ -3365,7 +3361,7 @@ impl<'test> TestCx<'test> {
33653361 // endif
33663362 }
33673363
3368- if self . config . target . contains ( "msvc" ) && self . config . cc != "" {
3364+ if self . config . target . contains ( "msvc" ) && ! self . config . cc . is_empty ( ) {
33693365 // We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
33703366 // and that `lib.exe` lives next to it.
33713367 let lib = Path :: new ( & self . config . cc ) . parent ( ) . unwrap ( ) . join ( "lib.exe" ) ;
@@ -3647,7 +3643,7 @@ impl<'test> TestCx<'test> {
36473643 // endif
36483644 }
36493645
3650- if self . config . target . contains ( "msvc" ) && self . config . cc != "" {
3646+ if self . config . target . contains ( "msvc" ) && ! self . config . cc . is_empty ( ) {
36513647 // We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
36523648 // and that `lib.exe` lives next to it.
36533649 let lib = Path :: new ( & self . config . cc ) . parent ( ) . unwrap ( ) . join ( "lib.exe" ) ;
@@ -3838,7 +3834,7 @@ impl<'test> TestCx<'test> {
38383834 && !self . props . dont_check_compiler_stderr
38393835 {
38403836 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" ,
38423838 & proc_res,
38433839 ) ;
38443840 }
@@ -4019,8 +4015,8 @@ impl<'test> TestCx<'test> {
40194015 crate_name. to_str ( ) . expect ( "crate name implies file name must be valid UTF-8" ) ;
40204016 // replace `a.foo` -> `a__foo` for crate name purposes.
40214017 // 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 ( '-' , "_" ) ;
40244020 rustc. arg ( "--crate-name" ) ;
40254021 rustc. arg ( crate_name) ;
40264022 }
@@ -4068,7 +4064,7 @@ impl<'test> TestCx<'test> {
40684064 fn check_mir_dump ( & self , test_info : MiroptTest ) {
40694065 let test_dir = self . testpaths . file . parent ( ) . unwrap ( ) ;
40704066 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 ( '-' , "_" ) ;
40724068
40734069 let MiroptTest { run_filecheck, suffix, files, passes : _ } = test_info;
40744070
0 commit comments