Skip to content

Commit 1af23d2

Browse files
rsdypksunkara
authored andcommitted
Add test code
1 parent b095247 commit 1af23d2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/ui/unwrap_literal.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#![warn(clippy::unnecessary_unwrap)]
2+
3+
fn unwrap_option() {
4+
let val = Some(1).unwrap();
5+
let val = Some(1).expect("this never happens");
6+
}
7+
8+
fn unwrap_result() {
9+
let val = Ok(1).unwrap();
10+
let val = Err(1).unwrap_err();
11+
let val = Ok(1).expect("this never happens");
12+
}
13+
14+
fn main() {
15+
unwrap_option();
16+
unwrap_result();
17+
}

0 commit comments

Comments
 (0)