03d3131cb4
Closes #7581
168 lines
5.5 KiB
Plaintext
168 lines
5.5 KiB
Plaintext
error: you checked before that `unwrap()` cannot fail, instead of checking and unwrapping, it's better to use `if let` or `match`
|
|
--> $DIR/simple_conditionals.rs:39:9
|
|
|
|
|
LL | if x.is_some() {
|
|
| ----------- the check is happening here
|
|
LL | x.unwrap(); // unnecessary
|
|
| ^^^^^^^^^^
|
|
|
|
|
note: the lint level is defined here
|
|
--> $DIR/simple_conditionals.rs:1:35
|
|
|
|
|
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: you checked before that `expect()` cannot fail, instead of checking and unwrapping, it's better to use `if let` or `match`
|
|
--> $DIR/simple_conditionals.rs:40:9
|
|
|
|
|
LL | if x.is_some() {
|
|
| ----------- the check is happening here
|
|
LL | x.unwrap(); // unnecessary
|
|
LL | x.expect("an error message"); // unnecessary
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this call to `unwrap()` will always panic
|
|
--> $DIR/simple_conditionals.rs:42:9
|
|
|
|
|
LL | if x.is_some() {
|
|
| ----------- because of this check
|
|
...
|
|
LL | x.unwrap(); // will panic
|
|
| ^^^^^^^^^^
|
|
|
|
|
note: the lint level is defined here
|
|
--> $DIR/simple_conditionals.rs:1:9
|
|
|
|
|
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this call to `expect()` will always panic
|
|
--> $DIR/simple_conditionals.rs:43:9
|
|
|
|
|
LL | if x.is_some() {
|
|
| ----------- because of this check
|
|
...
|
|
LL | x.expect("an error message"); // will panic
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this call to `unwrap()` will always panic
|
|
--> $DIR/simple_conditionals.rs:46:9
|
|
|
|
|
LL | if x.is_none() {
|
|
| ----------- because of this check
|
|
LL | x.unwrap(); // will panic
|
|
| ^^^^^^^^^^
|
|
|
|
error: you checked before that `unwrap()` cannot fail, instead of checking and unwrapping, it's better to use `if let` or `match`
|
|
--> $DIR/simple_conditionals.rs:48:9
|
|
|
|
|
LL | if x.is_none() {
|
|
| ----------- the check is happening here
|
|
...
|
|
LL | x.unwrap(); // unnecessary
|
|
| ^^^^^^^^^^
|
|
|
|
error: you checked before that `unwrap()` cannot fail, instead of checking and unwrapping, it's better to use `if let` or `match`
|
|
--> $DIR/simple_conditionals.rs:7:13
|
|
|
|
|
LL | if $a.is_some() {
|
|
| ------------ the check is happening here
|
|
LL | $a.unwrap(); // unnecessary
|
|
| ^^^^^^^^^^^
|
|
...
|
|
LL | m!(x);
|
|
| ------ in this macro invocation
|
|
|
|
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: you checked before that `unwrap()` cannot fail, instead of checking and unwrapping, it's better to use `if let` or `match`
|
|
--> $DIR/simple_conditionals.rs:56:9
|
|
|
|
|
LL | if x.is_ok() {
|
|
| --------- the check is happening here
|
|
LL | x.unwrap(); // unnecessary
|
|
| ^^^^^^^^^^
|
|
|
|
error: you checked before that `expect()` cannot fail, instead of checking and unwrapping, it's better to use `if let` or `match`
|
|
--> $DIR/simple_conditionals.rs:57:9
|
|
|
|
|
LL | if x.is_ok() {
|
|
| --------- the check is happening here
|
|
LL | x.unwrap(); // unnecessary
|
|
LL | x.expect("an error message"); // unnecessary
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this call to `unwrap_err()` will always panic
|
|
--> $DIR/simple_conditionals.rs:58:9
|
|
|
|
|
LL | if x.is_ok() {
|
|
| --------- because of this check
|
|
...
|
|
LL | x.unwrap_err(); // will panic
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: this call to `unwrap()` will always panic
|
|
--> $DIR/simple_conditionals.rs:60:9
|
|
|
|
|
LL | if x.is_ok() {
|
|
| --------- because of this check
|
|
...
|
|
LL | x.unwrap(); // will panic
|
|
| ^^^^^^^^^^
|
|
|
|
error: this call to `expect()` will always panic
|
|
--> $DIR/simple_conditionals.rs:61:9
|
|
|
|
|
LL | if x.is_ok() {
|
|
| --------- because of this check
|
|
...
|
|
LL | x.expect("an error message"); // will panic
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: you checked before that `unwrap_err()` cannot fail, instead of checking and unwrapping, it's better to use `if let` or `match`
|
|
--> $DIR/simple_conditionals.rs:62:9
|
|
|
|
|
LL | if x.is_ok() {
|
|
| --------- the check is happening here
|
|
...
|
|
LL | x.unwrap_err(); // unnecessary
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: this call to `unwrap()` will always panic
|
|
--> $DIR/simple_conditionals.rs:65:9
|
|
|
|
|
LL | if x.is_err() {
|
|
| ---------- because of this check
|
|
LL | x.unwrap(); // will panic
|
|
| ^^^^^^^^^^
|
|
|
|
error: you checked before that `unwrap_err()` cannot fail, instead of checking and unwrapping, it's better to use `if let` or `match`
|
|
--> $DIR/simple_conditionals.rs:66:9
|
|
|
|
|
LL | if x.is_err() {
|
|
| ---------- the check is happening here
|
|
LL | x.unwrap(); // will panic
|
|
LL | x.unwrap_err(); // unnecessary
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: you checked before that `unwrap()` cannot fail, instead of checking and unwrapping, it's better to use `if let` or `match`
|
|
--> $DIR/simple_conditionals.rs:68:9
|
|
|
|
|
LL | if x.is_err() {
|
|
| ---------- the check is happening here
|
|
...
|
|
LL | x.unwrap(); // unnecessary
|
|
| ^^^^^^^^^^
|
|
|
|
error: this call to `unwrap_err()` will always panic
|
|
--> $DIR/simple_conditionals.rs:69:9
|
|
|
|
|
LL | if x.is_err() {
|
|
| ---------- because of this check
|
|
...
|
|
LL | x.unwrap_err(); // will panic
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: aborting due to 17 previous errors
|
|
|