summary refs log tree commit diff
path: root/src/libstd/os.rs
diff options
context:
space:
mode:
authorAaron Turon <aturon@mozilla.com>2014-12-30 10:51:18 -0800
committerAaron Turon <aturon@mozilla.com>2014-12-30 17:06:08 -0800
commit6abfac083feafc73e5d736177755cce3bfb7153f (patch)
treed5502fab0dd68ea96057616eb20d90a2c9050218 /src/libstd/os.rs
parent6e1879eaf1cb5e727eb134a3e27018f7535852eb (diff)
downloadrust-6abfac083feafc73e5d736177755cce3bfb7153f.tar.gz
rust-6abfac083feafc73e5d736177755cce3bfb7153f.zip
Fallout from stabilization
Diffstat (limited to 'src/libstd/os.rs')
-rw-r--r--src/libstd/os.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index 989f44f7b8e..a9d9607395c 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -620,10 +620,11 @@ pub fn get_exit_status() -> int {
 unsafe fn load_argc_and_argv(argc: int,
                              argv: *const *const c_char) -> Vec<Vec<u8>> {
     use c_str::CString;
+    use iter::range;
 
-    Vec::from_fn(argc as uint, |i| {
+    range(0, argc as uint).map(|i| {
         CString::new(*argv.offset(i as int), false).as_bytes_no_nul().to_vec()
-    })
+    }).collect()
 }
 
 /// Returns the command line arguments
@@ -721,7 +722,7 @@ fn real_args() -> Vec<String> {
     let lpCmdLine = unsafe { GetCommandLineW() };
     let szArgList = unsafe { CommandLineToArgvW(lpCmdLine, lpArgCount) };
 
-    let args = Vec::from_fn(nArgs as uint, |i| unsafe {
+    let args: Vec<_> = range(0, nArgs as uint).map(|i| unsafe {
         // Determine the length of this argument.
         let ptr = *szArgList.offset(i as int);
         let mut len = 0;
@@ -732,7 +733,7 @@ fn real_args() -> Vec<String> {
         let buf = slice::from_raw_buf(&ptr, len);
         let opt_s = String::from_utf16(sys::os::truncate_utf16_at_nul(buf));
         opt_s.ok().expect("CommandLineToArgvW returned invalid UTF-16")
-    });
+    }).collect();
 
     unsafe {
         LocalFree(szArgList as *mut c_void);