diff --git a/src/test/run-pass/capturing-logging.rs b/src/test/run-pass/capturing-logging.rs index 171424d8b3b..17cd8db9d39 100644 --- a/src/test/run-pass/capturing-logging.rs +++ b/src/test/run-pass/capturing-logging.rs @@ -43,5 +43,5 @@ fn main() { debug!("debug"); info!("info"); }); - assert_eq!(r.read_to_str(), ~"info\n"); + assert_eq!(r.read_to_str().unwrap(), ~"info\n"); } diff --git a/src/test/run-pass/core-run-destroy.rs b/src/test/run-pass/core-run-destroy.rs index 3442e971f4f..f3ddc002333 100644 --- a/src/test/run-pass/core-run-destroy.rs +++ b/src/test/run-pass/core-run-destroy.rs @@ -27,8 +27,7 @@ fn test_destroy_once() { #[cfg(target_os="android")] static PROG: &'static str = "ls"; // android don't have echo binary - let mut p = run::Process::new(PROG, [], run::ProcessOptions::new()) - .expect(format!("failed to exec `{}`", PROG)); + let mut p = run::Process::new(PROG, [], run::ProcessOptions::new()).unwrap(); p.destroy(); // this shouldn't crash (and nor should the destructor) } @@ -39,12 +38,12 @@ fn test_destroy_twice() { #[cfg(target_os="android")] static PROG: &'static str = "ls"; // android don't have echo binary - let mut p = run::Process::new(PROG, [], run::ProcessOptions::new()) - .expect(format!("failed to exec `{}`", PROG)); + let mut p = match run::Process::new(PROG, [], run::ProcessOptions::new()) { + Ok(p) => p, + Err(e) => fail!("wut: {}", e), + }; p.destroy(); // this shouldnt crash... - io::io_error::cond.trap(|_| {}).inside(|| { - p.destroy(); // ...and nor should this (and nor should the destructor) - }) + p.destroy(); // ...and nor should this (and nor should the destructor) } fn test_destroy_actually_kills(force: bool) { @@ -61,14 +60,14 @@ fn test_destroy_actually_kills(force: bool) { #[cfg(unix,not(target_os="android"))] fn process_exists(pid: libc::pid_t) -> bool { let run::ProcessOutput {output, ..} = run::process_output("ps", [~"-p", pid.to_str()]) - .expect("failed to exec `ps`"); + .unwrap(); str::from_utf8_owned(output).unwrap().contains(pid.to_str()) } #[cfg(unix,target_os="android")] fn process_exists(pid: libc::pid_t) -> bool { let run::ProcessOutput {output, ..} = run::process_output("/system/bin/ps", [pid.to_str()]) - .expect("failed to exec `/system/bin/ps`"); + .unwrap(); str::from_utf8_owned(output).unwrap().contains(~"root") } @@ -93,7 +92,7 @@ fn test_destroy_actually_kills(force: bool) { // this process will stay alive indefinitely trying to read from stdin let mut p = run::Process::new(BLOCK_COMMAND, [], run::ProcessOptions::new()) - .expect(format!("failed to exec `{}`", BLOCK_COMMAND)); + .unwrap(); assert!(process_exists(p.get_id())); diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs index cc59ce5d8b2..b66446b0cfe 100644 --- a/src/test/run-pass/ifmt.rs +++ b/src/test/run-pass/ifmt.rs @@ -12,6 +12,7 @@ #[feature(macro_rules)]; #[deny(warnings)]; +#[allow(unused_must_use)]; use std::fmt; use std::io::MemWriter; @@ -22,10 +23,14 @@ struct A; struct B; impl fmt::Signed for A { - fn fmt(_: &A, f: &mut fmt::Formatter) { f.buf.write("aloha".as_bytes()); } + fn fmt(_: &A, f: &mut fmt::Formatter) -> fmt::Result { + f.buf.write("aloha".as_bytes()) + } } impl fmt::Signed for B { - fn fmt(_: &B, f: &mut fmt::Formatter) { f.buf.write("adios".as_bytes()); } + fn fmt(_: &B, f: &mut fmt::Formatter) -> fmt::Result { + f.buf.write("adios".as_bytes()) + } } macro_rules! t(($a:expr, $b:expr) => { assert_eq!($a, $b.to_owned()) }) @@ -286,9 +291,9 @@ fn test_format_args() { let mut buf = MemWriter::new(); { let w = &mut buf as &mut io::Writer; - format_args!(|args| { fmt::write(w, args) }, "{}", 1); - format_args!(|args| { fmt::write(w, args) }, "test"); - format_args!(|args| { fmt::write(w, args) }, "{test}", test=3); + format_args!(|args| { fmt::write(w, args); }, "{}", 1); + format_args!(|args| { fmt::write(w, args); }, "test"); + format_args!(|args| { fmt::write(w, args); }, "{test}", test=3); } let s = str::from_utf8_owned(buf.unwrap()).unwrap(); t!(s, "1test3"); diff --git a/src/test/run-pass/issue-8398.rs b/src/test/run-pass/issue-8398.rs index f9169618c2a..0884db63326 100644 --- a/src/test/run-pass/issue-8398.rs +++ b/src/test/run-pass/issue-8398.rs @@ -11,7 +11,7 @@ use std::io; fn foo(a: &mut io::Writer) { - a.write([]) + a.write([]).unwrap(); } pub fn main(){} diff --git a/src/test/run-pass/logging-only-prints-once.rs b/src/test/run-pass/logging-only-prints-once.rs index 4aef239f796..dccdc8ae3ba 100644 --- a/src/test/run-pass/logging-only-prints-once.rs +++ b/src/test/run-pass/logging-only-prints-once.rs @@ -17,10 +17,11 @@ use std::fmt; struct Foo(Cell); impl fmt::Show for Foo { - fn fmt(f: &Foo, _fmt: &mut fmt::Formatter) { + fn fmt(f: &Foo, _fmt: &mut fmt::Formatter) -> fmt::Result { let Foo(ref f) = *f; assert!(f.get() == 0); f.set(1); + Ok(()) } } diff --git a/src/test/run-pass/signal-exit-status.rs b/src/test/run-pass/signal-exit-status.rs index dc74e9fb470..0e8ca4d9942 100644 --- a/src/test/run-pass/signal-exit-status.rs +++ b/src/test/run-pass/signal-exit-status.rs @@ -19,8 +19,7 @@ pub fn main() { // Raise a segfault. unsafe { *(0 as *mut int) = 0; } } else { - let status = run::process_status(args[0], [~"signal"]) - .expect("failed to exec `signal`"); + let status = run::process_status(args[0], [~"signal"]).unwrap(); // Windows does not have signal, so we get exit status 0xC0000028 (STATUS_BAD_STACK). match status { process::ExitSignal(_) if cfg!(unix) => {}, diff --git a/src/test/run-pass/stat.rs b/src/test/run-pass/stat.rs index b186a682810..7f04da0734d 100644 --- a/src/test/run-pass/stat.rs +++ b/src/test/run-pass/stat.rs @@ -21,8 +21,8 @@ pub fn main() { { match File::create(&path) { - None => unreachable!(), - Some(f) => { + Err(..) => unreachable!(), + Ok(f) => { let mut f = f; for _ in range(0u, 1000) { f.write([0]); @@ -32,5 +32,5 @@ pub fn main() { } assert!(path.exists()); - assert_eq!(path.stat().size, 1000); + assert_eq!(path.stat().unwrap().size, 1000); }