mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 23:20:39 +00:00
313 lines
10 KiB
Text
313 lines
10 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/checked_unwrap.rs:19:9
|
|
|
|
|
18 | if x.is_some() {
|
|
| ----------- the check is happening here
|
|
19 | x.unwrap(); // unnecessary
|
|
| ^^^^^^^^^^
|
|
|
|
|
note: lint level defined here
|
|
--> $DIR/checked_unwrap.rs:13:35
|
|
|
|
|
13 | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: This call to `unwrap()` will always panic.
|
|
--> $DIR/checked_unwrap.rs:21:9
|
|
|
|
|
18 | if x.is_some() {
|
|
| ----------- because of this check
|
|
...
|
|
21 | x.unwrap(); // will panic
|
|
| ^^^^^^^^^^
|
|
|
|
|
note: lint level defined here
|
|
--> $DIR/checked_unwrap.rs:13:9
|
|
|
|
|
13 | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: This call to `unwrap()` will always panic.
|
|
--> $DIR/checked_unwrap.rs:24:9
|
|
|
|
|
23 | if x.is_none() {
|
|
| ----------- because of this check
|
|
24 | 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/checked_unwrap.rs:26:9
|
|
|
|
|
23 | if x.is_none() {
|
|
| ----------- the check is happening here
|
|
...
|
|
26 | 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/checked_unwrap.rs:30:9
|
|
|
|
|
29 | if x.is_ok() {
|
|
| --------- the check is happening here
|
|
30 | x.unwrap(); // unnecessary
|
|
| ^^^^^^^^^^
|
|
|
|
error: This call to `unwrap_err()` will always panic.
|
|
--> $DIR/checked_unwrap.rs:31:9
|
|
|
|
|
29 | if x.is_ok() {
|
|
| --------- because of this check
|
|
30 | x.unwrap(); // unnecessary
|
|
31 | x.unwrap_err(); // will panic
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: This call to `unwrap()` will always panic.
|
|
--> $DIR/checked_unwrap.rs:33:9
|
|
|
|
|
29 | if x.is_ok() {
|
|
| --------- because of this check
|
|
...
|
|
33 | 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/checked_unwrap.rs:34:9
|
|
|
|
|
29 | if x.is_ok() {
|
|
| --------- the check is happening here
|
|
...
|
|
34 | x.unwrap_err(); // unnecessary
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: This call to `unwrap()` will always panic.
|
|
--> $DIR/checked_unwrap.rs:37:9
|
|
|
|
|
36 | if x.is_err() {
|
|
| ---------- because of this check
|
|
37 | 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/checked_unwrap.rs:38:9
|
|
|
|
|
36 | if x.is_err() {
|
|
| ---------- the check is happening here
|
|
37 | x.unwrap(); // will panic
|
|
38 | 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/checked_unwrap.rs:40:9
|
|
|
|
|
36 | if x.is_err() {
|
|
| ---------- the check is happening here
|
|
...
|
|
40 | x.unwrap(); // unnecessary
|
|
| ^^^^^^^^^^
|
|
|
|
error: This call to `unwrap_err()` will always panic.
|
|
--> $DIR/checked_unwrap.rs:41:9
|
|
|
|
|
36 | if x.is_err() {
|
|
| ---------- because of this check
|
|
...
|
|
41 | x.unwrap_err(); // 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/checked_unwrap.rs:58:9
|
|
|
|
|
57 | if x.is_ok() && y.is_err() {
|
|
| --------- the check is happening here
|
|
58 | x.unwrap(); // unnecessary
|
|
| ^^^^^^^^^^
|
|
|
|
error: This call to `unwrap_err()` will always panic.
|
|
--> $DIR/checked_unwrap.rs:59:9
|
|
|
|
|
57 | if x.is_ok() && y.is_err() {
|
|
| --------- because of this check
|
|
58 | x.unwrap(); // unnecessary
|
|
59 | x.unwrap_err(); // will panic
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: This call to `unwrap()` will always panic.
|
|
--> $DIR/checked_unwrap.rs:60:9
|
|
|
|
|
57 | if x.is_ok() && y.is_err() {
|
|
| ---------- because of this check
|
|
...
|
|
60 | y.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/checked_unwrap.rs:61:9
|
|
|
|
|
57 | if x.is_ok() && y.is_err() {
|
|
| ---------- the check is happening here
|
|
...
|
|
61 | y.unwrap_err(); // unnecessary
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: This call to `unwrap()` will always panic.
|
|
--> $DIR/checked_unwrap.rs:75:9
|
|
|
|
|
70 | if x.is_ok() || y.is_ok() {
|
|
| --------- because of this check
|
|
...
|
|
75 | 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/checked_unwrap.rs:76:9
|
|
|
|
|
70 | if x.is_ok() || y.is_ok() {
|
|
| --------- the check is happening here
|
|
...
|
|
76 | x.unwrap_err(); // unnecessary
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: This call to `unwrap()` will always panic.
|
|
--> $DIR/checked_unwrap.rs:77:9
|
|
|
|
|
70 | if x.is_ok() || y.is_ok() {
|
|
| --------- because of this check
|
|
...
|
|
77 | y.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/checked_unwrap.rs:78:9
|
|
|
|
|
70 | if x.is_ok() || y.is_ok() {
|
|
| --------- the check is happening here
|
|
...
|
|
78 | y.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/checked_unwrap.rs:82:9
|
|
|
|
|
81 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
|
|
| --------- the check is happening here
|
|
82 | x.unwrap(); // unnecessary
|
|
| ^^^^^^^^^^
|
|
|
|
error: This call to `unwrap_err()` will always panic.
|
|
--> $DIR/checked_unwrap.rs:83:9
|
|
|
|
|
81 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
|
|
| --------- because of this check
|
|
82 | x.unwrap(); // unnecessary
|
|
83 | x.unwrap_err(); // will panic
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: This call to `unwrap()` will always panic.
|
|
--> $DIR/checked_unwrap.rs:84:9
|
|
|
|
|
81 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
|
|
| --------- because of this check
|
|
...
|
|
84 | y.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/checked_unwrap.rs:85:9
|
|
|
|
|
81 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
|
|
| --------- the check is happening here
|
|
...
|
|
85 | y.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/checked_unwrap.rs:86:9
|
|
|
|
|
81 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
|
|
| ---------- the check is happening here
|
|
...
|
|
86 | z.unwrap(); // unnecessary
|
|
| ^^^^^^^^^^
|
|
|
|
error: This call to `unwrap_err()` will always panic.
|
|
--> $DIR/checked_unwrap.rs:87:9
|
|
|
|
|
81 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
|
|
| ---------- because of this check
|
|
...
|
|
87 | z.unwrap_err(); // will panic
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: This call to `unwrap()` will always panic.
|
|
--> $DIR/checked_unwrap.rs:95:9
|
|
|
|
|
89 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
|
|
| --------- because of this check
|
|
...
|
|
95 | 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/checked_unwrap.rs:96:9
|
|
|
|
|
89 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
|
|
| --------- the check is happening here
|
|
...
|
|
96 | 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/checked_unwrap.rs:97:9
|
|
|
|
|
89 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
|
|
| --------- the check is happening here
|
|
...
|
|
97 | y.unwrap(); // unnecessary
|
|
| ^^^^^^^^^^
|
|
|
|
error: This call to `unwrap_err()` will always panic.
|
|
--> $DIR/checked_unwrap.rs:98:9
|
|
|
|
|
89 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
|
|
| --------- because of this check
|
|
...
|
|
98 | y.unwrap_err(); // will panic
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: This call to `unwrap()` will always panic.
|
|
--> $DIR/checked_unwrap.rs:99:9
|
|
|
|
|
89 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
|
|
| ---------- because of this check
|
|
...
|
|
99 | z.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/checked_unwrap.rs:100:9
|
|
|
|
|
89 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
|
|
| ---------- the check is happening here
|
|
...
|
|
100 | z.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/checked_unwrap.rs:108:13
|
|
|
|
|
107 | if x.is_some() {
|
|
| ----------- the check is happening here
|
|
108 | x.unwrap(); // unnecessary
|
|
| ^^^^^^^^^^
|
|
|
|
error: This call to `unwrap()` will always panic.
|
|
--> $DIR/checked_unwrap.rs:110:13
|
|
|
|
|
107 | if x.is_some() {
|
|
| ----------- because of this check
|
|
...
|
|
110 | x.unwrap(); // will panic
|
|
| ^^^^^^^^^^
|
|
|
|
error: aborting due to 34 previous errors
|
|
|