@@ -631,10 +631,6 @@ fn iter_header<R: Read>(testfile: &Path, cfg: Option<&str>, rdr: R, it: &mut dyn
631
631
632
632
let comment = if testfile. to_string_lossy ( ) . ends_with ( ".rs" ) { "//" } else { "#" } ;
633
633
634
- // FIXME: would be nice to allow some whitespace between comment and brace :)
635
- // It took me like 2 days to debug why compile-flags weren’t taken into account for my test :)
636
- let comment_with_brace = comment. to_string ( ) + "[" ;
637
-
638
634
let mut rdr = BufReader :: new ( rdr) ;
639
635
let mut ln = String :: new ( ) ;
640
636
@@ -650,7 +646,7 @@ fn iter_header<R: Read>(testfile: &Path, cfg: Option<&str>, rdr: R, it: &mut dyn
650
646
let ln = ln. trim ( ) ;
651
647
if ln. starts_with ( "fn" ) || ln. starts_with ( "mod" ) {
652
648
return ;
653
- } else if ln. starts_with ( & comment_with_brace ) {
649
+ } else if ln. starts_with ( comment ) && ln [ comment . len ( ) .. ] . trim_start ( ) . starts_with ( '[' ) {
654
650
// A comment like `//[foo]` is specific to revision `foo`
655
651
if let Some ( close_brace) = ln. find ( ']' ) {
656
652
let open_brace = ln. find ( '[' ) . unwrap ( ) ;
@@ -663,10 +659,7 @@ fn iter_header<R: Read>(testfile: &Path, cfg: Option<&str>, rdr: R, it: &mut dyn
663
659
it ( ln[ ( close_brace + 1 ) ..] . trim_start ( ) ) ;
664
660
}
665
661
} else {
666
- panic ! (
667
- "malformed condition directive: expected `{}foo]`, found `{}`" ,
668
- comment_with_brace, ln
669
- )
662
+ panic ! ( "malformed condition directive: expected `{}[foo]`, found `{}`" , comment, ln)
670
663
}
671
664
} else if ln. starts_with ( comment) {
672
665
it ( ln[ comment. len ( ) ..] . trim_start ( ) ) ;
0 commit comments