diff --git a/src/chroot/chroot.rs b/src/chroot/chroot.rs index 1b7f3e1aa..bb43cf1eb 100644 --- a/src/chroot/chroot.rs +++ b/src/chroot/chroot.rs @@ -126,9 +126,7 @@ fn set_context(root: &Path, options: &getopts::Matches) { fn enter_chroot(root: &Path) { let root_str = root.display(); - if !std::os::change_dir(root) { - crash!(1, "cannot chdir to {}", root_str) - }; + std::os::change_dir(root).unwrap(); let err = unsafe { chroot(".".to_c_str().unwrap() as *const libc::c_char) }; diff --git a/src/cp/cp.rs b/src/cp/cp.rs index d056bc236..c5f366cb0 100644 --- a/src/cp/cp.rs +++ b/src/cp/cp.rs @@ -168,12 +168,12 @@ pub fn paths_refer_to_same_file(p1: &Path, p2: &Path) -> io::IoResult { if p1_lstat.kind == io::TypeSymlink { raw_p1 = fs::readlink(&raw_p1).unwrap(); } - raw_p1 = os::make_absolute(&raw_p1); + raw_p1 = os::make_absolute(&raw_p1).unwrap(); if p2_lstat.kind == io::TypeSymlink { raw_p2 = fs::readlink(&raw_p2).unwrap(); } - raw_p2 = os::make_absolute(&raw_p2); + raw_p2 = os::make_absolute(&raw_p2).unwrap(); Ok(raw_p1 == raw_p2) } diff --git a/src/mv/mv.rs b/src/mv/mv.rs index 9d4a4ca8b..fa43ac7c3 100644 --- a/src/mv/mv.rs +++ b/src/mv/mv.rs @@ -318,7 +318,7 @@ fn rename(from: &Path, to: &Path, b: &Behaviour) -> IoResult<()> { fn read_yes() -> bool { match BufferedReader::new(stdin_raw()).read_line() { Ok(s) => match s.as_slice().slice_shift_char() { - (Some(x), _) => x == 'y' || x == 'Y', + Some((x, _)) => x == 'y' || x == 'Y', _ => false }, _ => false diff --git a/src/realpath/realpath.rs b/src/realpath/realpath.rs index e4ab63729..982d09ba9 100644 --- a/src/realpath/realpath.rs +++ b/src/realpath/realpath.rs @@ -62,7 +62,7 @@ pub fn uumain(args: Vec) -> int { fn resolve_path(path: &str, strip: bool, zero: bool, quiet: bool) -> bool { let p = Path::new(path); - let abs = std::os::make_absolute(&p); + let abs = std::os::make_absolute(&p).unwrap(); if strip { if zero { diff --git a/src/relpath/relpath.rs b/src/relpath/relpath.rs index 9a7e8119a..22f228261 100644 --- a/src/relpath/relpath.rs +++ b/src/relpath/relpath.rs @@ -50,14 +50,14 @@ pub fn uumain(args: Vec) -> int { let from = if opts.free.len() > 1 { Path::new(opts.free[1].as_slice()) } else { - std::os::getcwd() + std::os::getcwd().unwrap() }; - let absto = std::os::make_absolute(&to); - let absfrom = std::os::make_absolute(&from); + let absto = std::os::make_absolute(&to).unwrap(); + let absfrom = std::os::make_absolute(&from).unwrap(); if opts.opt_present("d") { let base = Path::new(opts.opt_str("d").unwrap()); - let absbase = std::os::make_absolute(&base); + let absbase = std::os::make_absolute(&base).unwrap(); if !absbase.is_ancestor_of(&absto) || !absbase.is_ancestor_of(&absfrom) { println!("{}", absto.display()); return 0