Merge pull request #130 from alan-andrade/fix_master

Fix master by comparing against slices, not ~
This commit is contained in:
Arcterus 2014-03-13 16:55:34 -07:00
commit a75e42d4db
4 changed files with 12 additions and 12 deletions

12
env/env.rs vendored
View file

@ -92,13 +92,13 @@ fn main() {
}
}
} else if opt.starts_with("--") {
match *opt {
~"--help" => { usage(prog); return }
~"--version" => { version(); return }
match opt.as_slice() {
"--help" => { usage(prog); return }
"--version" => { version(); return }
~"--ignore-environment" => opts.ignore_env = true,
~"--null" => opts.null = true,
~"--unset" => {
"--ignore-environment" => opts.ignore_env = true,
"--null" => opts.null = true,
"--unset" => {
let var = iter.next();
match var {

View file

@ -128,7 +128,7 @@ fn obsolete (options: &mut ~[~str]) -> Option<uint> {
}
fn head<T: Reader> (reader: &mut BufferedReader<T>, line_count:uint) {
for line in reader.lines().take(line_count) { print!("{:s}", line); }
for line in reader.lines().take(line_count) { print!("{}", line); }
}
fn version () {

View file

@ -87,10 +87,10 @@ fn main() {
} else if matches.opt_present("I") {
InteractiveOnce
} else if matches.opt_present("interactive") {
match matches.opt_str("interactive").unwrap() {
~"none" => InteractiveNone,
~"once" => InteractiveOnce,
~"always" => InteractiveAlways,
match matches.opt_str("interactive").unwrap().as_slice() {
"none" => InteractiveNone,
"once" => InteractiveOnce,
"always" => InteractiveAlways,
val => {
crash!(1, "Invalid argument to interactive ({})", val)
}

View file

@ -88,7 +88,7 @@ fn sleep(args: &[~str]) {
}
fn match_suffix(arg: &mut ~str) -> Result<int, ~str> {
let result = match (*arg).pop_char() {
let result = match (*arg).pop_char().unwrap() {
's' | 'S' => Ok(1),
'm' | 'M' => Ok(60),
'h' | 'H' => Ok(60 * 60),