rust/tests/ui/checked_unwrap.stderr

314 lines
10 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/checked_unwrap.rs:7:9
|
6 | if x.is_some() {
| ----------- the check is happening here
7 | x.unwrap(); // unnecessary
| ^^^^^^^^^^
|
note: lint level defined here
--> $DIR/checked_unwrap.rs:1:27
|
1 | #![deny(panicking_unwrap, unnecessary_unwrap)]
| ^^^^^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:9:9
|
6 | if x.is_some() {
| ----------- because of this check
...
9 | x.unwrap(); // will panic
| ^^^^^^^^^^
|
note: lint level defined here
--> $DIR/checked_unwrap.rs:1:9
|
1 | #![deny(panicking_unwrap, unnecessary_unwrap)]
| ^^^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:12:9
|
11 | if x.is_none() {
| ----------- because of this check
12 | 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:14:9
|
11 | if x.is_none() {
| ----------- the check is happening here
...
14 | 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:18:9
|
17 | if x.is_ok() {
| --------- the check is happening here
18 | x.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:19:9
|
17 | if x.is_ok() {
| --------- because of this check
18 | x.unwrap(); // unnecessary
19 | x.unwrap_err(); // will panic
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:21:9
|
17 | if x.is_ok() {
| --------- because of this check
...
21 | 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:22:9
|
17 | if x.is_ok() {
| --------- the check is happening here
...
22 | x.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:25:9
|
24 | if x.is_err() {
| ---------- because of this check
25 | 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:26:9
|
24 | if x.is_err() {
| ---------- the check is happening here
25 | x.unwrap(); // will panic
26 | 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:28:9
|
24 | if x.is_err() {
| ---------- the check is happening here
...
28 | x.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:29:9
|
24 | if x.is_err() {
| ---------- because of this check
...
29 | 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:46:9
|
45 | if x.is_ok() && y.is_err() {
| --------- the check is happening here
46 | x.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:47:9
|
45 | if x.is_ok() && y.is_err() {
| --------- because of this check
46 | x.unwrap(); // unnecessary
47 | x.unwrap_err(); // will panic
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:48:9
|
45 | if x.is_ok() && y.is_err() {
| ---------- because of this check
...
48 | 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:49:9
|
45 | if x.is_ok() && y.is_err() {
| ---------- the check is happening here
...
49 | y.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:63:9
|
58 | if x.is_ok() || y.is_ok() {
| --------- because of this check
...
63 | 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:64:9
|
58 | if x.is_ok() || y.is_ok() {
| --------- the check is happening here
...
64 | x.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:65:9
|
58 | if x.is_ok() || y.is_ok() {
| --------- because of this check
...
65 | 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:66:9
|
58 | if x.is_ok() || y.is_ok() {
| --------- the check is happening here
...
66 | 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:70:9
|
69 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| --------- the check is happening here
70 | x.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:71:9
|
69 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| --------- because of this check
70 | x.unwrap(); // unnecessary
71 | x.unwrap_err(); // will panic
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:72:9
|
69 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| --------- because of this check
...
72 | 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:73:9
|
69 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| --------- the check is happening here
...
73 | 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:74:9
|
69 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| ---------- the check is happening here
...
74 | z.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:75:9
|
69 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| ---------- because of this check
...
75 | z.unwrap_err(); // will panic
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:83:9
|
77 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| --------- because of this check
...
83 | 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:84:9
|
77 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| --------- the check is happening here
...
84 | 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:85:9
|
77 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| --------- the check is happening here
...
85 | y.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:86:9
|
77 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| --------- because of this check
...
86 | y.unwrap_err(); // will panic
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:87:9
|
77 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| ---------- because of this check
...
87 | 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:88:9
|
77 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| ---------- the check is happening here
...
88 | 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:96:13
|
95 | if x.is_some() {
| ----------- the check is happening here
96 | x.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:98:13
|
95 | if x.is_some() {
| ----------- because of this check
...
98 | x.unwrap(); // will panic
| ^^^^^^^^^^
error: aborting due to 34 previous errors