@@ -374,11 +374,11 @@ impl<'test> TestCx<'test> {
374374
375375 // if a test does not crash, consider it an error
376376 if proc_res. status . success ( ) || matches ! ( proc_res. status. code( ) , Some ( 1 | 0 ) ) {
377- self . fatal ( & format ! (
377+ self . fatal (
378378 "test no longer crashes/triggers ICE! Please give it a mearningful name, \
379379 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+ ) ;
382382 }
383383 }
384384
@@ -697,10 +697,10 @@ impl<'test> TestCx<'test> {
697697 // since it is extensively used in the testsuite.
698698 check_cfg. push_str ( "cfg(FALSE" ) ;
699699 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) ) ;
702702 }
703- check_cfg. push_str ( ")" ) ;
703+ check_cfg. push ( ')' ) ;
704704
705705 cmd. args ( & [ "--check-cfg" , & check_cfg] ) ;
706706 }
@@ -818,7 +818,7 @@ impl<'test> TestCx<'test> {
818818 // Append the other `cdb-command:`s
819819 for line in & dbg_cmds. commands {
820820 script_str. push_str ( line) ;
821- script_str. push_str ( " \n " ) ;
821+ script_str. push ( '\n' ) ;
822822 }
823823
824824 script_str. push_str ( "qq\n " ) ; // Quit the debugger (including remote debugger, if any)
@@ -1200,7 +1200,7 @@ impl<'test> TestCx<'test> {
12001200 // Append the other commands
12011201 for line in & dbg_cmds. commands {
12021202 script_str. push_str ( line) ;
1203- script_str. push_str ( " \n " ) ;
1203+ script_str. push ( '\n' ) ;
12041204 }
12051205
12061206 // Finally, quit the debugger
@@ -1250,7 +1250,7 @@ impl<'test> TestCx<'test> {
12501250 // Remove options that are either unwanted (-O) or may lead to duplicates due to RUSTFLAGS.
12511251 let options_to_remove = [ "-O" . to_owned ( ) , "-g" . to_owned ( ) , "--debuginfo" . to_owned ( ) ] ;
12521252
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 ( )
12541254 }
12551255
12561256 fn maybe_add_external_args ( & self , cmd : & mut Command , args : & Vec < String > ) {
@@ -2504,8 +2504,8 @@ impl<'test> TestCx<'test> {
25042504 // This works with both `--emit asm` (as default output name for the assembly)
25052505 // and `ptx-linker` because the latter can write output at requested location.
25062506 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 ( ) )
25092509 }
25102510 }
25112511
@@ -2752,7 +2752,7 @@ impl<'test> TestCx<'test> {
27522752 for entry in walkdir:: WalkDir :: new ( dir) {
27532753 let entry = entry. expect ( "failed to read file" ) ;
27542754 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" )
27562756 {
27572757 let status =
27582758 Command :: new ( "tidy" ) . args ( & tidy_args) . arg ( entry. path ( ) ) . status ( ) . unwrap ( ) ;
@@ -2783,8 +2783,7 @@ impl<'test> TestCx<'test> {
27832783 & compare_dir,
27842784 self . config . verbose ,
27852785 |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" ) )
27882787 } ,
27892788 ) {
27902789 return ;
@@ -2830,11 +2829,11 @@ impl<'test> TestCx<'test> {
28302829 }
28312830 match String :: from_utf8 ( line. clone ( ) ) {
28322831 Ok ( line) => {
2833- if line. starts_with ( "+" ) {
2832+ if line. starts_with ( '+' ) {
28342833 write ! ( & mut out, "{}" , line. green( ) ) . unwrap ( ) ;
2835- } else if line. starts_with ( "-" ) {
2834+ } else if line. starts_with ( '-' ) {
28362835 write ! ( & mut out, "{}" , line. red( ) ) . unwrap ( ) ;
2837- } else if line. starts_with ( "@" ) {
2836+ } else if line. starts_with ( '@' ) {
28382837 write ! ( & mut out, "{}" , line. blue( ) ) . unwrap ( ) ;
28392838 } else {
28402839 out. write_all ( line. as_bytes ( ) ) . unwrap ( ) ;
@@ -2907,7 +2906,7 @@ impl<'test> TestCx<'test> {
29072906 && line. ends_with ( ';' )
29082907 {
29092908 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 ( ';' , "" ) ) ;
29112910 }
29122911 None
29132912 } else {
@@ -3139,7 +3138,7 @@ impl<'test> TestCx<'test> {
31393138 let mut string = String :: new ( ) ;
31403139 for cgu in cgus {
31413140 string. push_str ( & cgu[ ..] ) ;
3142- string. push_str ( " " ) ;
3141+ string. push ( ' ' ) ;
31433142 }
31443143
31453144 string
@@ -3172,10 +3171,7 @@ impl<'test> TestCx<'test> {
31723171 // CGUs joined with "--". This function splits such composite CGU names
31733172 // and handles each component individually.
31743173 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 ( "--" )
31793175 }
31803176 }
31813177
@@ -3357,7 +3353,7 @@ impl<'test> TestCx<'test> {
33573353 // endif
33583354 }
33593355
3360- if self . config . target . contains ( "msvc" ) && self . config . cc != "" {
3356+ if self . config . target . contains ( "msvc" ) && ! self . config . cc . is_empty ( ) {
33613357 // We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
33623358 // and that `lib.exe` lives next to it.
33633359 let lib = Path :: new ( & self . config . cc ) . parent ( ) . unwrap ( ) . join ( "lib.exe" ) ;
@@ -3639,7 +3635,7 @@ impl<'test> TestCx<'test> {
36393635 // endif
36403636 }
36413637
3642- if self . config . target . contains ( "msvc" ) && self . config . cc != "" {
3638+ if self . config . target . contains ( "msvc" ) && ! self . config . cc . is_empty ( ) {
36433639 // We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
36443640 // and that `lib.exe` lives next to it.
36453641 let lib = Path :: new ( & self . config . cc ) . parent ( ) . unwrap ( ) . join ( "lib.exe" ) ;
@@ -3830,7 +3826,7 @@ impl<'test> TestCx<'test> {
38303826 && !self . props . dont_check_compiler_stderr
38313827 {
38323828 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" ,
38343830 & proc_res,
38353831 ) ;
38363832 }
@@ -4011,8 +4007,8 @@ impl<'test> TestCx<'test> {
40114007 crate_name. to_str ( ) . expect ( "crate name implies file name must be valid UTF-8" ) ;
40124008 // replace `a.foo` -> `a__foo` for crate name purposes.
40134009 // 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 ( '-' , "_" ) ;
40164012 rustc. arg ( "--crate-name" ) ;
40174013 rustc. arg ( crate_name) ;
40184014 }
@@ -4060,7 +4056,7 @@ impl<'test> TestCx<'test> {
40604056 fn check_mir_dump ( & self , test_info : MiroptTest ) {
40614057 let test_dir = self . testpaths . file . parent ( ) . unwrap ( ) ;
40624058 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 ( '-' , "_" ) ;
40644060
40654061 let MiroptTest { run_filecheck, suffix, files, passes : _ } = test_info;
40664062
0 commit comments