1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

Fix master by comparing against slices, not ~

This commit is contained in:
Alan Andrade 2014-03-13 16:10:02 -07:00
parent a10cb64f7e
commit 1dc2cd3a0f
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("--") { } else if opt.starts_with("--") {
match *opt { match opt.as_slice() {
~"--help" => { usage(prog); return } "--help" => { usage(prog); return }
~"--version" => { version(); return } "--version" => { version(); return }
~"--ignore-environment" => opts.ignore_env = true, "--ignore-environment" => opts.ignore_env = true,
~"--null" => opts.null = true, "--null" => opts.null = true,
~"--unset" => { "--unset" => {
let var = iter.next(); let var = iter.next();
match var { 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) { 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 () { fn version () {

View file

@ -87,10 +87,10 @@ fn main() {
} else if matches.opt_present("I") { } else if matches.opt_present("I") {
InteractiveOnce InteractiveOnce
} else if matches.opt_present("interactive") { } else if matches.opt_present("interactive") {
match matches.opt_str("interactive").unwrap() { match matches.opt_str("interactive").unwrap().as_slice() {
~"none" => InteractiveNone, "none" => InteractiveNone,
~"once" => InteractiveOnce, "once" => InteractiveOnce,
~"always" => InteractiveAlways, "always" => InteractiveAlways,
val => { val => {
crash!(1, "Invalid argument to interactive ({})", 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> { 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), 's' | 'S' => Ok(1),
'm' | 'M' => Ok(60), 'm' | 'M' => Ok(60),
'h' | 'H' => Ok(60 * 60), 'h' | 'H' => Ok(60 * 60),