2023-02-16 08:21:43 -06:00
|
|
|
//run-rustfix
|
2023-02-16 05:32:12 -06:00
|
|
|
#![warn(clippy::unnecessary_literal_unwrap)]
|
|
|
|
|
|
|
|
fn unwrap_option() {
|
2023-02-16 08:37:18 -06:00
|
|
|
let _val = Some(1).unwrap();
|
|
|
|
let _val = Some(1).expect("this never happens");
|
|
|
|
}
|
|
|
|
|
|
|
|
fn unwrap_result() {
|
|
|
|
let _val = Ok::<usize, ()>(1).unwrap();
|
|
|
|
let _val = Ok::<usize, ()>(1).expect("this never happens");
|
|
|
|
// let val = Err(1).unwrap_err();
|
2023-02-16 05:32:12 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
unwrap_option();
|
2023-02-16 08:37:18 -06:00
|
|
|
unwrap_result();
|
2023-02-16 05:32:12 -06:00
|
|
|
}
|