Rollup merge of #33474 - frewsxcv:unwrap-err, r=alexcrichton
Utilize `Result::unwrap_err` in more places. None
This commit is contained in:
commit
fffaf665f2
13 changed files with 22 additions and 22 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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() };
|
||||
|
|
|
|||
|
|
@ -27,6 +27,6 @@ fn main() {
|
|||
thread::spawn(move|| -> () {
|
||||
let _a = A;
|
||||
panic!();
|
||||
}).join().err().unwrap();
|
||||
}).join().unwrap_err();
|
||||
assert!(unsafe { !HIT });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,5 +39,5 @@ mod b {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
thread::spawn(move|| { ::b::g() }).join().err().unwrap();
|
||||
thread::spawn(move|| { ::b::g() }).join().unwrap_err();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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.");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue