Skip to content

Commit

Permalink
Add test code
Browse files Browse the repository at this point in the history
  • Loading branch information
rsdy authored and pksunkara committed Jun 12, 2023
1 parent b095247 commit 1af23d2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/ui/unwrap_literal.rs
Original file line number Diff line number Diff line change
@@ -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();
}

0 comments on commit 1af23d2

Please sign in to comment.