10
10
11
11
use std:: env;
12
12
use std:: fs:: File ;
13
- use std:: io:: BufReader ;
14
13
use std:: io:: prelude:: * ;
14
+ use std:: io:: BufReader ;
15
15
use std:: path:: { Path , PathBuf } ;
16
16
17
- use common:: Config ;
18
17
use common;
18
+ use common:: Config ;
19
19
use util;
20
20
21
21
use extract_gdb_version;
@@ -38,19 +38,14 @@ impl EarlyProps {
38
38
revisions : vec ! [ ] ,
39
39
} ;
40
40
41
- iter_header ( testfile,
42
- None ,
43
- & mut |ln| {
41
+ iter_header ( testfile, None , & mut |ln| {
44
42
// we should check if any only-<platform> exists and if it exists
45
43
// and does not matches the current platform, skip the test
46
- props. ignore =
47
- props. ignore ||
48
- config. parse_cfg_name_directive ( ln, "ignore" ) ||
49
- ( config. has_cfg_prefix ( ln, "only" ) &&
50
- !config. parse_cfg_name_directive ( ln, "only" ) ) ||
51
- ignore_gdb ( config, ln) ||
52
- ignore_lldb ( config, ln) ||
53
- ignore_llvm ( config, ln) ;
44
+ props. ignore = props. ignore || config. parse_cfg_name_directive ( ln, "ignore" )
45
+ || ( config. has_cfg_prefix ( ln, "only" )
46
+ && !config. parse_cfg_name_directive ( ln, "only" ) )
47
+ || ignore_gdb ( config, ln) || ignore_lldb ( config, ln)
48
+ || ignore_llvm ( config, ln) ;
54
49
55
50
if let Some ( s) = config. parse_aux_build ( ln) {
56
51
props. aux . push ( s) ;
@@ -149,7 +144,7 @@ impl EarlyProps {
149
144
150
145
fn ignore_llvm ( config : & Config , line : & str ) -> bool {
151
146
if config. system_llvm && line. starts_with ( "no-system-llvm" ) {
152
- return true ;
147
+ return true ;
153
148
}
154
149
if let Some ( ref actual_version) = config. llvm_version {
155
150
if line. starts_with ( "min-llvm-version" ) {
@@ -272,11 +267,7 @@ impl TestProps {
272
267
}
273
268
}
274
269
275
- pub fn from_aux_file ( & self ,
276
- testfile : & Path ,
277
- cfg : Option < & str > ,
278
- config : & Config )
279
- -> Self {
270
+ pub fn from_aux_file ( & self , testfile : & Path , cfg : Option < & str > , config : & Config ) -> Self {
280
271
let mut props = TestProps :: new ( ) ;
281
272
282
273
// copy over select properties to the aux build:
@@ -296,20 +287,15 @@ impl TestProps {
296
287
/// tied to a particular revision `foo` (indicated by writing
297
288
/// `//[foo]`), then the property is ignored unless `cfg` is
298
289
/// `Some("foo")`.
299
- fn load_from ( & mut self ,
300
- testfile : & Path ,
301
- cfg : Option < & str > ,
302
- config : & Config ) {
303
- iter_header ( testfile,
304
- cfg,
305
- & mut |ln| {
290
+ fn load_from ( & mut self , testfile : & Path , cfg : Option < & str > , config : & Config ) {
291
+ iter_header ( testfile, cfg, & mut |ln| {
306
292
if let Some ( ep) = config. parse_error_pattern ( ln) {
307
293
self . error_patterns . push ( ep) ;
308
294
}
309
295
310
296
if let Some ( flags) = config. parse_compile_flags ( ln) {
311
- self . compile_flags . extend ( flags . split_whitespace ( )
312
- . map ( |s| s. to_owned ( ) ) ) ;
297
+ self . compile_flags
298
+ . extend ( flags . split_whitespace ( ) . map ( |s| s. to_owned ( ) ) ) ;
313
299
}
314
300
315
301
if let Some ( r) = config. parse_revisions ( ln) {
@@ -382,8 +368,7 @@ impl TestProps {
382
368
383
369
if !self . compile_pass {
384
370
// run-pass implies must_compile_sucessfully
385
- self . compile_pass =
386
- config. parse_compile_pass ( ln) || self . run_pass ;
371
+ self . compile_pass = config. parse_compile_pass ( ln) || self . run_pass ;
387
372
}
388
373
389
374
if !self . skip_trans {
@@ -453,7 +438,7 @@ fn iter_header(testfile: &Path, cfg: Option<&str>, it: &mut FnMut(&str)) {
453
438
None => false ,
454
439
} ;
455
440
if matches {
456
- it ( ln[ ( close_brace + 1 ) ..] . trim_left ( ) ) ;
441
+ it ( ln[ ( close_brace + 1 ) ..] . trim_left ( ) ) ;
457
442
}
458
443
} else {
459
444
panic ! ( "malformed condition directive: expected `{}foo]`, found `{}`" ,
@@ -554,9 +539,7 @@ impl Config {
554
539
fn parse_env ( & self , line : & str , name : & str ) -> Option < ( String , String ) > {
555
540
self . parse_name_value_directive ( line, name) . map ( |nv| {
556
541
// nv is either FOO or FOO=BAR
557
- let mut strs: Vec < String > = nv. splitn ( 2 , '=' )
558
- . map ( str:: to_owned)
559
- . collect ( ) ;
542
+ let mut strs: Vec < String > = nv. splitn ( 2 , '=' ) . map ( str:: to_owned) . collect ( ) ;
560
543
561
544
match strs. len ( ) {
562
545
1 => ( strs. pop ( ) . unwrap ( ) , "" . to_owned ( ) ) ,
@@ -599,7 +582,10 @@ impl Config {
599
582
/// or `normalize-stderr-32bit`. Returns `true` if the line matches it.
600
583
fn parse_cfg_name_directive ( & self , line : & str , prefix : & str ) -> bool {
601
584
if line. starts_with ( prefix) && line. as_bytes ( ) . get ( prefix. len ( ) ) == Some ( & b'-' ) {
602
- let name = line[ prefix. len ( ) +1 ..] . split ( & [ ':' , ' ' ] [ ..] ) . next ( ) . unwrap ( ) ;
585
+ let name = line[ prefix. len ( ) + 1 ..]
586
+ . split ( & [ ':' , ' ' ] [ ..] )
587
+ . next ( )
588
+ . unwrap ( ) ;
603
589
604
590
name == "test" ||
605
591
util:: matches_os ( & self . target , name) || // target
@@ -612,8 +598,7 @@ impl Config {
612
598
common:: DebugInfoLldb => name == "lldb" ,
613
599
common:: Pretty => name == "pretty" ,
614
600
_ => false ,
615
- } ||
616
- ( self . target != self . host && name == "cross-compile" )
601
+ } || ( self . target != self . host && name == "cross-compile" )
617
602
} else {
618
603
false
619
604
}
@@ -631,14 +616,14 @@ impl Config {
631
616
// the line says "ignore-x86_64".
632
617
line. starts_with ( directive) && match line. as_bytes ( ) . get ( directive. len ( ) ) {
633
618
None | Some ( & b' ' ) | Some ( & b':' ) => true ,
634
- _ => false
619
+ _ => false ,
635
620
}
636
621
}
637
622
638
623
pub fn parse_name_value_directive ( & self , line : & str , directive : & str ) -> Option < String > {
639
624
let colon = directive. len ( ) ;
640
625
if line. starts_with ( directive) && line. as_bytes ( ) . get ( colon) == Some ( & b':' ) {
641
- let value = line[ ( colon + 1 ) ..] . to_owned ( ) ;
626
+ let value = line[ ( colon + 1 ) ..] . to_owned ( ) ;
642
627
debug ! ( "{}: {}" , directive, value) ;
643
628
Some ( expand_variables ( value, self ) )
644
629
} else {
@@ -665,8 +650,10 @@ impl Config {
665
650
}
666
651
667
652
pub fn lldb_version_to_int ( version_string : & str ) -> isize {
668
- let error_string = format ! ( "Encountered LLDB version string with unexpected format: {}" ,
669
- version_string) ;
653
+ let error_string = format ! (
654
+ "Encountered LLDB version string with unexpected format: {}" ,
655
+ version_string
656
+ ) ;
670
657
version_string. parse ( ) . expect ( & error_string)
671
658
}
672
659
@@ -713,6 +700,6 @@ fn parse_normalization_string(line: &mut &str) -> Option<String> {
713
700
None => return None ,
714
701
} ;
715
702
let result = line[ begin..end] . to_owned ( ) ;
716
- * line = & line[ end+ 1 ..] ;
703
+ * line = & line[ end + 1 ..] ;
717
704
Some ( result)
718
705
}
0 commit comments