env::args return Strings now

This commit is contained in:
Michael Gehring 2015-02-13 20:57:47 +01:00
parent ec9c8659ea
commit 50301e63ee
3 changed files with 4 additions and 8 deletions

View file

@ -10,17 +10,13 @@ extern crate \"@UTIL_CRATE@\" as uu@UTIL_CRATE@;
use std::env; use std::env;
use uu@UTIL_CRATE@::uumain; use uu@UTIL_CRATE@::uumain;
fn args() -> Vec<String> {
env::args().map(|a| a.into_string().unwrap()).collect()
}
fn main() { fn main() {
env::set_exit_status(uumain(args())); env::set_exit_status(uumain(env::args().collect()));
} }
"; ";
fn main() { fn main() {
let args : Vec<String> = env::args().map(|a| a.into_string().unwrap()).collect(); let args : Vec<String> = env::args().collect();
if args.len() != 3 { if args.len() != 3 {
println!("usage: mkbuild <crate> <outfile>"); println!("usage: mkbuild <crate> <outfile>");
env::set_exit_status(1); env::set_exit_status(1);

View file

@ -5,7 +5,7 @@ use std::old_io::{File, Truncate, Write};
use std::old_path::Path; use std::old_path::Path;
fn main() { fn main() {
let args : Vec<String> = env::args().map(|a| a.into_string().unwrap()).collect(); let args : Vec<String> = env::args().collect();
if args.len() < 3 { if args.len() < 3 {
println!("usage: mkuutils <outfile> <crates>"); println!("usage: mkuutils <outfile> <crates>");
env::set_exit_status(1); env::set_exit_status(1);

View file

@ -41,7 +41,7 @@ fn usage(cmap: &HashMap<&'static str, fn(Vec<String>) -> i32>) {
fn main() { fn main() {
let umap = util_map(); let umap = util_map();
let mut args : Vec<String> = env::args().map(|a| a.into_string().unwrap()).collect(); let mut args : Vec<String> = env::args().collect();
// try binary name as util name. // try binary name as util name.
let binary = Path::new(args[0].as_slice()); let binary = Path::new(args[0].as_slice());