Add test code

This commit is contained in:
rsdy 2023-02-16 10:47:12 +00:00 committed by Pavan Kumar Sunkara
parent b095247ab6
commit 1af23d2463

View 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();
}