Track init and unwrap of expr

This commit is contained in:
rsdy 2023-02-16 15:30:09 +00:00 committed by Pavan Kumar Sunkara
parent 7ed7283e0f
commit 6e0e09c8f7
3 changed files with 40 additions and 3 deletions

View file

@ -0,0 +1,6 @@
#![warn(clippy::unnecessary_literal_unwrap)]
fn main() {
let val = Some(1);
let _val2 = val.unwrap();
}

View file

@ -0,0 +1,15 @@
error: used `unwrap()` on `Some` value
--> $DIR/unnecessary_literal_unwrap_unfixable.rs:5:17
|
LL | let _val2 = val.unwrap();
| ^^^^^^^^^^^^
|
help: remove the `Some` and `unwrap()`
--> $DIR/unnecessary_literal_unwrap_unfixable.rs:4:15
|
LL | let val = Some(1);
| ^^^^^^^
= note: `-D clippy::unnecessary-literal-unwrap` implied by `-D warnings`
error: aborting due to previous error