Add test code
This commit is contained in:
parent
b095247ab6
commit
1af23d2463
17
tests/ui/unwrap_literal.rs
Normal file
17
tests/ui/unwrap_literal.rs
Normal file
@ -0,0 +1,17 @@
|
||||
#![warn(clippy::unnecessary_unwrap)]
|
||||
|
||||
fn unwrap_option() {
|
||||
let val = Some(1).unwrap();
|
||||
let val = Some(1).expect("this never happens");
|
||||
}
|
||||
|
||||
fn unwrap_result() {
|
||||
let val = Ok(1).unwrap();
|
||||
let val = Err(1).unwrap_err();
|
||||
let val = Ok(1).expect("this never happens");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
unwrap_option();
|
||||
unwrap_result();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user