@@ -263,11 +263,19 @@ impl<'test> TestCx<'test> {
263263 Ui | MirOpt => false ,
264264 mode => panic ! ( "unimplemented for mode {:?}" , mode) ,
265265 } ;
266- if test_should_run { self . run_if_enabled ( ) } else { WillExecute :: No }
266+ if test_should_run {
267+ self . run_if_enabled ( )
268+ } else {
269+ WillExecute :: No
270+ }
267271 }
268272
269273 fn run_if_enabled ( & self ) -> WillExecute {
270- if self . config . run_enabled ( ) { WillExecute :: Yes } else { WillExecute :: Disabled }
274+ if self . config . run_enabled ( ) {
275+ WillExecute :: Yes
276+ } else {
277+ WillExecute :: Disabled
278+ }
271279 }
272280
273281 fn should_run_successfully ( & self , pm : Option < PassMode > ) -> bool {
@@ -661,6 +669,19 @@ impl<'test> TestCx<'test> {
661669 }
662670
663671 fn run_debuginfo_cdb_test_no_opt ( & self ) {
672+ let exe_file = self . make_exe_name ( ) ;
673+
674+ // Existing PDB files are update in-place. When changing the debuginfo
675+ // the compiler generates for something, this can lead to the situation
676+ // where both the old and the new version of the debuginfo for the same
677+ // type is present in the PDB, which is very confusing.
678+ // Therefore we delete any existing PDB file before compiling the test
679+ // case.
680+ let pdb_file = exe_file. with_extension ( ".pdb" ) ;
681+ if pdb_file. exists ( ) {
682+ std:: fs:: remove_file ( pdb_file) . unwrap ( ) ;
683+ }
684+
664685 // compile test file (it should have 'compile-flags:-g' in the header)
665686 let should_run = self . run_if_enabled ( ) ;
666687 let compile_result = self . compile_test ( should_run, EmitMetadata :: No ) ;
@@ -671,8 +692,6 @@ impl<'test> TestCx<'test> {
671692 return ;
672693 }
673694
674- let exe_file = self . make_exe_name ( ) ;
675-
676695 let prefixes = {
677696 static PREFIXES : & [ & str ] = & [ "cdb" , "cdbg" ] ;
678697 // No "native rust support" variation for CDB yet.
@@ -2010,7 +2029,11 @@ impl<'test> TestCx<'test> {
20102029 Some ( ref s) => s
20112030 . split ( ' ' )
20122031 . filter_map ( |s| {
2013- if s. chars ( ) . all ( |c| c. is_whitespace ( ) ) { None } else { Some ( s. to_owned ( ) ) }
2032+ if s. chars ( ) . all ( |c| c. is_whitespace ( ) ) {
2033+ None
2034+ } else {
2035+ Some ( s. to_owned ( ) )
2036+ }
20142037 } )
20152038 . collect ( ) ,
20162039 None => Vec :: new ( ) ,
@@ -2069,7 +2092,11 @@ impl<'test> TestCx<'test> {
20692092 /// The revision, ignored for incremental compilation since it wants all revisions in
20702093 /// the same directory.
20712094 fn safe_revision ( & self ) -> Option < & str > {
2072- if self . config . mode == Incremental { None } else { self . revision }
2095+ if self . config . mode == Incremental {
2096+ None
2097+ } else {
2098+ self . revision
2099+ }
20732100 }
20742101
20752102 /// Gets the absolute path to the directory where all output for the given
@@ -2224,7 +2251,11 @@ impl<'test> TestCx<'test> {
22242251
22252252 fn charset ( ) -> & ' static str {
22262253 // FreeBSD 10.1 defaults to GDB 6.1.1 which doesn't support "auto" charset
2227- if cfg ! ( target_os = "freebsd" ) { "ISO-8859-1" } else { "UTF-8" }
2254+ if cfg ! ( target_os = "freebsd" ) {
2255+ "ISO-8859-1"
2256+ } else {
2257+ "UTF-8"
2258+ }
22282259 }
22292260
22302261 fn run_rustdoc_test ( & self ) {
@@ -3014,7 +3045,11 @@ impl<'test> TestCx<'test> {
30143045 let ( stderr_kind, stdout_kind) = match output_kind {
30153046 TestOutput :: Compile => (
30163047 {
3017- if self . props . stderr_per_bitwidth { & stderr_bits } else { UI_STDERR }
3048+ if self . props . stderr_per_bitwidth {
3049+ & stderr_bits
3050+ } else {
3051+ UI_STDERR
3052+ }
30183053 } ,
30193054 UI_STDOUT ,
30203055 ) ,
@@ -3711,7 +3746,11 @@ impl<'test> TestCx<'test> {
37113746 for output_file in files {
37123747 println ! ( "Actual {} saved to {}" , kind, output_file. display( ) ) ;
37133748 }
3714- if self . config . bless { 0 } else { 1 }
3749+ if self . config . bless {
3750+ 0
3751+ } else {
3752+ 1
3753+ }
37153754 }
37163755
37173756 fn prune_duplicate_output ( & self , mode : CompareMode , kind : & str , canon_content : & str ) {
0 commit comments