Rollup merge of #33474 - frewsxcv:unwrap-err, r=alexcrichton

Utilize `Result::unwrap_err` in more places.

None
This commit is contained in:
Manish Goregaokar 2016-05-09 12:50:21 -07:00
commit fffaf665f2
No known key found for this signature in database
GPG key ID: 3BBF4D3E2EF79F98
13 changed files with 22 additions and 22 deletions

View file

@ -25,7 +25,7 @@ fn main() {
thread::spawn(move|| {
let _a = A;
lib::callback(|| panic!());
}).join().err().unwrap();
}).join().unwrap_err();
unsafe {
assert_eq!(lib::statik, 1);

View file

@ -62,7 +62,7 @@ fn main() {
let output = Command::new(&me).arg("bad").before_exec(|| {
Err(Error::from_raw_os_error(102))
}).output().err().unwrap();
}).output().unwrap_err();
assert_eq!(output.raw_os_error(), Some(102));
let pid = unsafe { libc::getpid() };

View file

@ -27,6 +27,6 @@ fn main() {
thread::spawn(move|| -> () {
let _a = A;
panic!();
}).join().err().unwrap();
}).join().unwrap_err();
assert!(unsafe { !HIT });
}

View file

@ -28,10 +28,10 @@ fn main() {
panic!("hi there");
});
panic::propagate(result.err().unwrap());
panic::propagate(result.unwrap_err());
}).join();
let msg = *result.err().unwrap().downcast::<&'static str>().unwrap();
let msg = *result.unwrap_err().downcast::<&'static str>().unwrap();
assert_eq!("hi there", msg);
assert_eq!(1, A.load(Ordering::SeqCst));
}

View file

@ -39,5 +39,5 @@ mod b {
}
fn main() {
thread::spawn(move|| { ::b::g() }).join().err().unwrap();
thread::spawn(move|| { ::b::g() }).join().unwrap_err();
}

View file

@ -24,13 +24,13 @@ fn test_ret() { let _x: Box<isize> = return; }
fn test_panic() {
fn f() { let _x: Box<isize> = panic!(); }
thread::spawn(move|| f() ).join().err().unwrap();
thread::spawn(move|| f() ).join().unwrap_err();
}
fn test_panic_indirect() {
fn f() -> ! { panic!(); }
fn g() { let _x: Box<isize> = f(); }
thread::spawn(move|| g() ).join().err().unwrap();
thread::spawn(move|| g() ).join().unwrap_err();
}
pub fn main() {

View file

@ -30,6 +30,6 @@ pub fn main() {
let _b = Foo;
}).join();
let s = x.err().unwrap().downcast::<&'static str>().unwrap();
let s = x.unwrap_err().downcast::<&'static str>().unwrap();
assert_eq!(&**s, "This panic should happen.");
}