99// except according to those terms.
1010
1111#![ crate_type = "bin" ]
12- #![ allow( unknown_features) ]
13- #![ feature( slicing_syntax, unboxed_closures) ]
12+
1413#![ feature( box_syntax) ]
14+ #![ feature( collections) ]
15+ #![ feature( core) ]
1516#![ feature( int_uint) ]
16- #![ feature( test) ]
17- #![ feature( rustc_private) ]
18- #![ feature( std_misc) ]
19- #![ feature( path) ]
2017#![ feature( io) ]
21- #![ feature( core) ]
22- #![ feature( collections) ]
2318#![ feature( os) ]
19+ #![ feature( path) ]
20+ #![ feature( rustc_private) ]
21+ #![ feature( slicing_syntax, unboxed_closures) ]
22+ #![ feature( std_misc) ]
23+ #![ feature( test) ]
2424#![ feature( unicode) ]
25+ #![ feature( env) ]
2526
26- #![ allow( unstable) ]
2727#![ deny( warnings) ]
2828
2929extern crate test;
@@ -32,10 +32,9 @@ extern crate getopts;
3232#[ macro_use]
3333extern crate log;
3434
35- use std:: os ;
35+ use std:: env ;
3636use std:: old_io;
3737use std:: old_io:: fs;
38- use std:: str:: FromStr ;
3938use std:: thunk:: Thunk ;
4039use getopts:: { optopt, optflag, reqopt} ;
4140use common:: Config ;
@@ -50,7 +49,7 @@ pub mod common;
5049pub mod errors;
5150
5251pub fn main ( ) {
53- let args = os :: args ( ) ;
52+ let args = env :: args ( ) . map ( |s| s . into_string ( ) . unwrap ( ) ) . collect ( ) ; ;
5453 let config = parse_config ( args) ;
5554
5655 if config. valgrind_path . is_none ( ) && config. force_valgrind {
@@ -140,9 +139,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
140139 build_base : opt_path ( matches, "build-base" ) ,
141140 aux_base : opt_path ( matches, "aux-base" ) ,
142141 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" ) ,
146143 run_ignored : matches. opt_present ( "ignored" ) ,
147144 filter : filter,
148145 logfile : matches. opt_str ( "logfile" ) . map ( |s| Path :: new ( s) ) ,
@@ -231,15 +228,15 @@ pub fn run_tests(config: &Config) {
231228 // android debug-info test uses remote debugger
232229 // so, we test 1 task at once.
233230 // 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" ) ;
235232 }
236233
237234 match config. mode {
238235 DebugInfoLldb => {
239236 // Some older versions of LLDB seem to have problems with multiple
240237 // instances running in parallel, so only run one test task at a
241238 // time.
242- os :: setenv ( "RUST_TEST_TASKS" , "1" ) ;
239+ env :: set_var ( "RUST_TEST_TASKS" , "1" ) ;
243240 }
244241 _ => { /* proceed */ }
245242 }
@@ -252,7 +249,7 @@ pub fn run_tests(config: &Config) {
252249 old_io:: test:: raise_fd_limit ( ) ;
253250 // Prevent issue #21352 UAC blocking .exe containing 'patch' etc. on Windows
254251 // If #11207 is resolved (adding manifest to .exe) this becomes unnecessary
255- os :: setenv ( "__COMPAT_LAYER" , "RunAsInvoker" ) ;
252+ env :: set_var ( "__COMPAT_LAYER" , "RunAsInvoker" ) ;
256253 let res = test:: run_tests_console ( & opts, tests. into_iter ( ) . collect ( ) ) ;
257254 match res {
258255 Ok ( true ) => { }
@@ -283,7 +280,7 @@ pub fn make_tests(config: &Config) -> Vec<test::TestDescAndFn> {
283280 config. src_base. display( ) ) ;
284281 let mut tests = Vec :: new ( ) ;
285282 let dirs = fs:: readdir ( & config. src_base ) . unwrap ( ) ;
286- for file in dirs. iter ( ) {
283+ for file in & dirs {
287284 let file = file. clone ( ) ;
288285 debug ! ( "inspecting file {:?}" , file. display( ) ) ;
289286 if is_test ( config, & file) {
@@ -311,13 +308,13 @@ pub fn is_test(config: &Config, testfile: &Path) -> bool {
311308
312309 let mut valid = false ;
313310
314- for ext in valid_extensions. iter ( ) {
311+ for ext in & valid_extensions {
315312 if name. ends_with ( ext. as_slice ( ) ) {
316313 valid = true ;
317314 }
318315 }
319316
320- for pre in invalid_prefixes. iter ( ) {
317+ for pre in & invalid_prefixes {
321318 if name. starts_with ( pre. as_slice ( ) ) {
322319 valid = false ;
323320 }
0 commit comments