@@ -244,7 +244,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
244244 None => copy * config
245245 } ;
246246 let config = & mut config;
247- let cmds = str :: connect ( props. debugger_cmds , "\n " ) ;
247+ let cmds = props. debugger_cmds . connect ( "\n " ) ;
248248 let check_lines = copy props. check_lines ;
249249
250250 // compile test file (it shoud have 'compile-flags:-g' in the header)
@@ -278,7 +278,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
278278 // check if each line in props.check_lines appears in the
279279 // output (in order)
280280 let mut i = 0 u;
281- for str :: each_line ( ProcRes . stdout) |line| {
281+ for ProcRes . stdout. line_iter ( ) . advance |line| {
282282 if check_lines[ i] . trim( ) == line. trim( ) {
283283 i += 1 u;
284284 }
@@ -308,8 +308,8 @@ fn check_error_patterns(props: &TestProps,
308308 let mut next_err_idx = 0 u;
309309 let mut next_err_pat = & props. error_patterns[ next_err_idx] ;
310310 let mut done = false ;
311- for str :: each_line ( ProcRes . stderr) |line| {
312- if str :: contains ( line , * next_err_pat) {
311+ for ProcRes . stderr. line_iter ( ) . advance |line| {
312+ if line . contains( * next_err_pat) {
313313 debug ! ( "found error pattern %s" , * next_err_pat) ;
314314 next_err_idx += 1 u;
315315 if next_err_idx == props. error_patterns. len( ) {
@@ -358,15 +358,15 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
358358 // filename:line1:col1: line2:col2: *warning:* msg
359359 // where line1:col1: is the starting point, line2:col2:
360360 // is the ending point, and * represents ANSI color codes.
361- for str :: each_line ( ProcRes . stderr) |line| {
361+ for ProcRes . stderr. line_iter ( ) . advance |line| {
362362 let mut was_expected = false ;
363363 for vec:: eachi( expected_errors) |i, ee| {
364364 if !found_flags[ i] {
365365 debug ! ( "prefix=%s ee.kind=%s ee.msg=%s line=%s" ,
366366 prefixes[ i] , ee. kind, ee. msg, line) ;
367- if ( str :: starts_with ( line , prefixes[ i] ) &&
368- str :: contains ( line , ee. kind ) &&
369- str :: contains ( line , ee. msg ) ) {
367+ if ( line . starts_with( prefixes[ i] ) &&
368+ line . contains( ee. kind) &&
369+ line . contains( ee. msg) ) {
370370 found_flags[ i] = true;
371371 was_expected = true;
372372 break ;
@@ -375,7 +375,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
375375 }
376376
377377 // ignore this msg which gets printed at the end
378- if str :: contains ( line , "aborting due to" ) {
378+ if line . contains ( "aborting due to" ) {
379379 was_expected = true ;
380380 }
381381
@@ -417,7 +417,7 @@ fn scan_until_char(haystack: &str, needle: char, idx: &mut uint) -> bool {
417417 if * idx >= haystack. len ( ) {
418418 return false ;
419419 }
420- let opt = str :: find_char_from ( haystack, needle , * idx) ;
420+ let opt = haystack. slice_from ( * idx) . find ( needle ) ;
421421 if opt. is_none ( ) {
422422 return false ;
423423 }
@@ -429,7 +429,7 @@ fn scan_char(haystack: &str, needle: char, idx: &mut uint) -> bool {
429429 if * idx >= haystack. len ( ) {
430430 return false ;
431431 }
432- let range = str :: char_range_at ( haystack , * idx) ;
432+ let range = haystack . char_range_at ( * idx) ;
433433 if range. ch != needle {
434434 return false ;
435435 }
@@ -440,7 +440,7 @@ fn scan_char(haystack: &str, needle: char, idx: &mut uint) -> bool {
440440fn scan_integer ( haystack : & str , idx : & mut uint ) -> bool {
441441 let mut i = * idx;
442442 while i < haystack. len ( ) {
443- let range = str :: char_range_at ( haystack , i) ;
443+ let range = haystack . char_range_at ( i) ;
444444 if range. ch < '0' || '9' < range. ch {
445445 break ;
446446 }
@@ -460,7 +460,7 @@ fn scan_string(haystack: &str, needle: &str, idx: &mut uint) -> bool {
460460 if haystack_i >= haystack. len ( ) {
461461 return false ;
462462 }
463- let range = str :: char_range_at ( haystack , haystack_i) ;
463+ let range = haystack . char_range_at ( haystack_i) ;
464464 haystack_i = range. next ;
465465 if !scan_char ( needle, range. ch , & mut needle_i) {
466466 return false ;
@@ -612,15 +612,11 @@ fn make_run_args(config: &config, _props: &TestProps, testfile: &Path) ->
612612}
613613
614614fn split_maybe_args ( argstr : & Option < ~str > ) -> ~[ ~str ] {
615- fn rm_whitespace ( v : ~[ ~str ] ) -> ~[ ~str ] {
616- v. filtered ( |s| !str:: is_whitespace ( * s) )
617- }
618-
619615 match * argstr {
620616 Some ( ref s) => {
621- let mut ss = ~ [ ] ;
622- for str :: each_split_char ( * s , ' ' ) |s| { ss . push ( s. to_owned ( ) ) }
623- rm_whitespace ( ss )
617+ s . split_iter ( ' ' )
618+ . filter_map ( |s| if s . is_whitespace ( ) { None } else { Some ( s. to_owned ( ) ) } )
619+ . collect ( )
624620 }
625621 None => ~[ ]
626622 }
@@ -649,13 +645,13 @@ fn program_output(config: &config, testfile: &Path, lib_path: &str, prog: ~str,
649645#[ cfg( target_os = "macos" ) ]
650646#[ cfg( target_os = "freebsd" ) ]
651647fn make_cmdline ( _libpath : & str , prog : & str , args : & [ ~str ] ) -> ~str {
652- fmt ! ( "%s %s" , prog, str :: connect( args , " " ) )
648+ fmt ! ( "%s %s" , prog, args . connect( " " ) )
653649}
654650
655651#[ cfg( target_os = "win32" ) ]
656652fn make_cmdline ( libpath : & str , prog : & str , args : & [ ~str ] ) -> ~str {
657653 fmt ! ( "%s %s %s" , lib_path_cmd_prefix( libpath) , prog,
658- str :: connect( args , " " ) )
654+ args . connect( " " ) )
659655}
660656
661657// Build the LD_LIBRARY_PATH variable as it would be seen on the command line
@@ -739,8 +735,7 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps,
739735 let cmdline = make_cmdline ( "" , args. prog , args. args ) ;
740736
741737 // get bare program string
742- let mut tvec = ~[ ] ;
743- for str:: each_split_char( args. prog, '/' ) |ts| { tvec. push ( ts. to_owned ( ) ) }
738+ let mut tvec: ~[ ~str ] = args. prog . split_iter ( '/' ) . transform ( |ts| ts. to_owned ( ) ) . collect ( ) ;
744739 let prog_short = tvec. pop ( ) ;
745740
746741 // copy to target
0 commit comments