9
9
// except according to those terms.
10
10
11
11
#![ crate_type = "bin" ]
12
- #![ allow( unknown_features) ]
13
- #![ feature( slicing_syntax, unboxed_closures) ]
12
+
14
13
#![ feature( box_syntax) ]
14
+ #![ feature( collections) ]
15
+ #![ feature( core) ]
15
16
#![ feature( int_uint) ]
16
- #![ feature( test) ]
17
- #![ feature( rustc_private) ]
18
- #![ feature( std_misc) ]
19
- #![ feature( path) ]
20
17
#![ feature( io) ]
21
- #![ feature( core) ]
22
- #![ feature( collections) ]
23
18
#![ feature( os) ]
19
+ #![ feature( path) ]
20
+ #![ feature( rustc_private) ]
21
+ #![ feature( slicing_syntax, unboxed_closures) ]
22
+ #![ feature( std_misc) ]
23
+ #![ feature( test) ]
24
24
#![ feature( unicode) ]
25
+ #![ feature( env) ]
25
26
26
- #![ allow( unstable) ]
27
27
#![ deny( warnings) ]
28
28
29
29
extern crate test;
@@ -32,10 +32,9 @@ extern crate getopts;
32
32
#[ macro_use]
33
33
extern crate log;
34
34
35
- use std:: os ;
35
+ use std:: env ;
36
36
use std:: old_io;
37
37
use std:: old_io:: fs;
38
- use std:: str:: FromStr ;
39
38
use std:: thunk:: Thunk ;
40
39
use getopts:: { optopt, optflag, reqopt} ;
41
40
use common:: Config ;
@@ -50,7 +49,7 @@ pub mod common;
50
49
pub mod errors;
51
50
52
51
pub fn main ( ) {
53
- let args = os :: args ( ) ;
52
+ let args = env :: args ( ) . map ( |s| s . into_string ( ) . unwrap ( ) ) . collect ( ) ; ;
54
53
let config = parse_config ( args) ;
55
54
56
55
if config. valgrind_path . is_none ( ) && config. force_valgrind {
@@ -140,9 +139,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
140
139
build_base : opt_path ( matches, "build-base" ) ,
141
140
aux_base : opt_path ( matches, "aux-base" ) ,
142
141
stage_id : matches. opt_str ( "stage-id" ) . unwrap ( ) ,
143
- mode : FromStr :: from_str ( matches. opt_str ( "mode" )
144
- . unwrap ( )
145
- . as_slice ( ) ) . expect ( "invalid mode" ) ,
142
+ mode : matches. opt_str ( "mode" ) . unwrap ( ) . parse ( ) . ok ( ) . expect ( "invalid mode" ) ,
146
143
run_ignored : matches. opt_present ( "ignored" ) ,
147
144
filter : filter,
148
145
logfile : matches. opt_str ( "logfile" ) . map ( |s| Path :: new ( s) ) ,
@@ -231,15 +228,15 @@ pub fn run_tests(config: &Config) {
231
228
// android debug-info test uses remote debugger
232
229
// so, we test 1 task at once.
233
230
// also trying to isolate problems with adb_run_wrapper.sh ilooping
234
- os :: setenv ( "RUST_TEST_TASKS" , "1" ) ;
231
+ env :: set_var ( "RUST_TEST_TASKS" , "1" ) ;
235
232
}
236
233
237
234
match config. mode {
238
235
DebugInfoLldb => {
239
236
// Some older versions of LLDB seem to have problems with multiple
240
237
// instances running in parallel, so only run one test task at a
241
238
// time.
242
- os :: setenv ( "RUST_TEST_TASKS" , "1" ) ;
239
+ env :: set_var ( "RUST_TEST_TASKS" , "1" ) ;
243
240
}
244
241
_ => { /* proceed */ }
245
242
}
@@ -252,7 +249,7 @@ pub fn run_tests(config: &Config) {
252
249
old_io:: test:: raise_fd_limit ( ) ;
253
250
// Prevent issue #21352 UAC blocking .exe containing 'patch' etc. on Windows
254
251
// If #11207 is resolved (adding manifest to .exe) this becomes unnecessary
255
- os :: setenv ( "__COMPAT_LAYER" , "RunAsInvoker" ) ;
252
+ env :: set_var ( "__COMPAT_LAYER" , "RunAsInvoker" ) ;
256
253
let res = test:: run_tests_console ( & opts, tests. into_iter ( ) . collect ( ) ) ;
257
254
match res {
258
255
Ok ( true ) => { }
@@ -283,7 +280,7 @@ pub fn make_tests(config: &Config) -> Vec<test::TestDescAndFn> {
283
280
config. src_base. display( ) ) ;
284
281
let mut tests = Vec :: new ( ) ;
285
282
let dirs = fs:: readdir ( & config. src_base ) . unwrap ( ) ;
286
- for file in dirs. iter ( ) {
283
+ for file in & dirs {
287
284
let file = file. clone ( ) ;
288
285
debug ! ( "inspecting file {:?}" , file. display( ) ) ;
289
286
if is_test ( config, & file) {
@@ -311,13 +308,13 @@ pub fn is_test(config: &Config, testfile: &Path) -> bool {
311
308
312
309
let mut valid = false ;
313
310
314
- for ext in valid_extensions. iter ( ) {
311
+ for ext in & valid_extensions {
315
312
if name. ends_with ( ext. as_slice ( ) ) {
316
313
valid = true ;
317
314
}
318
315
}
319
316
320
- for pre in invalid_prefixes. iter ( ) {
317
+ for pre in & invalid_prefixes {
321
318
if name. starts_with ( pre. as_slice ( ) ) {
322
319
valid = false ;
323
320
}
0 commit comments