@@ -13,23 +13,25 @@ use std::str;
13
13
use std:: io:: process:: { ProcessExit , Process , ProcessConfig , ProcessOutput } ;
14
14
15
15
#[ cfg( target_os = "win32" ) ]
16
- fn target_env ( lib_path : & str , prog : & str ) -> Vec < ( ~str , ~str ) > {
17
-
18
- let mut env = os:: env ( ) ;
16
+ fn target_env ( lib_path : & str , prog : & str ) -> Vec < ( ~str , ~str ) > {
17
+ let env = os:: env ( ) ;
19
18
20
19
// Make sure we include the aux directory in the path
21
20
assert ! ( prog. ends_with( ".exe" ) ) ;
22
21
let aux_path = prog. slice ( 0 u, prog. len ( ) - 4 u) . to_owned ( ) + ".libaux" ;
23
22
24
- env = env. map ( |pair| {
25
- let ( k, v) = ( * pair) . clone ( ) ;
26
- if k == ~"PATH " { ( ~"PATH ", v + ";" + lib_path + ";" + aux_path) }
27
- else { ( k, v) }
28
- } ) ;
23
+ let mut new_env: Vec < _ > = env. move_iter ( ) . map ( |( k, v) | {
24
+ let new_v = if "PATH" == k {
25
+ format ! ( "{};{};{}" , v, lib_path, aux_path)
26
+ } else {
27
+ v
28
+ } ;
29
+ ( k, new_v)
30
+ } ) . collect ( ) ;
29
31
if prog. ends_with ( "rustc.exe" ) {
30
- env . push ( ( ~"RUST_THREADS ", ~"1 ") ) ;
32
+ new_env . push ( ( ~"RUST_THREADS ", ~"1 ") ) ;
31
33
}
32
- return env ;
34
+ return new_env ;
33
35
}
34
36
35
37
#[ cfg( target_os = "linux" ) ]
0 commit comments