mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-11 05:42:47 +00:00
32 lines
1 KiB
Text
32 lines
1 KiB
Text
|
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
|
||
|
--> $DIR/complex_conditionals_nested.rs:8:13
|
||
|
|
|
||
|
LL | if x.is_some() {
|
||
|
| ----------- the check is happening here
|
||
|
LL | x.unwrap(); // unnecessary
|
||
|
| ^^^^^^^^^^
|
||
|
|
|
||
|
note: the lint level is defined here
|
||
|
--> $DIR/complex_conditionals_nested.rs:1:35
|
||
|
|
|
||
|
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
|
|
||
|
error: This call to `unwrap()` will always panic.
|
||
|
--> $DIR/complex_conditionals_nested.rs:10:13
|
||
|
|
|
||
|
LL | if x.is_some() {
|
||
|
| ----------- because of this check
|
||
|
...
|
||
|
LL | x.unwrap(); // will panic
|
||
|
| ^^^^^^^^^^
|
||
|
|
|
||
|
note: the lint level is defined here
|
||
|
--> $DIR/complex_conditionals_nested.rs:1:9
|
||
|
|
|
||
|
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||
|
|
||
|
error: aborting due to 2 previous errors
|
||
|
|