]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr
Auto merge of #84620 - Dylan-DPC:rollup-wkv97im, r=Dylan-DPC
[rust.git] / src / tools / clippy / tests / ui / checked_unwrap / simple_conditionals.stderr
1 error: you checked before that `unwrap()` cannot fail, instead of checking and unwrapping, it's better to use `if let` or `match`
2   --> $DIR/simple_conditionals.rs:39:9
3    |
4 LL |     if x.is_some() {
5    |        ----------- the check is happening here
6 LL |         x.unwrap(); // unnecessary
7    |         ^^^^^^^^^^
8    |
9 note: the lint level is defined here
10   --> $DIR/simple_conditionals.rs:1:35
11    |
12 LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
13    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
14
15 error: this call to `unwrap()` will always panic
16   --> $DIR/simple_conditionals.rs:41:9
17    |
18 LL |     if x.is_some() {
19    |        ----------- because of this check
20 ...
21 LL |         x.unwrap(); // will panic
22    |         ^^^^^^^^^^
23    |
24 note: the lint level is defined here
25   --> $DIR/simple_conditionals.rs:1:9
26    |
27 LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
28    |         ^^^^^^^^^^^^^^^^^^^^^^^^
29
30 error: this call to `unwrap()` will always panic
31   --> $DIR/simple_conditionals.rs:44:9
32    |
33 LL |     if x.is_none() {
34    |        ----------- because of this check
35 LL |         x.unwrap(); // will panic
36    |         ^^^^^^^^^^
37
38 error: you checked before that `unwrap()` cannot fail, instead of checking and unwrapping, it's better to use `if let` or `match`
39   --> $DIR/simple_conditionals.rs:46:9
40    |
41 LL |     if x.is_none() {
42    |        ----------- the check is happening here
43 ...
44 LL |         x.unwrap(); // unnecessary
45    |         ^^^^^^^^^^
46
47 error: you checked before that `unwrap()` cannot fail, instead of checking and unwrapping, it's better to use `if let` or `match`
48   --> $DIR/simple_conditionals.rs:7:13
49    |
50 LL |         if $a.is_some() {
51    |            ------------ the check is happening here
52 LL |             $a.unwrap(); // unnecessary
53    |             ^^^^^^^^^^^
54 ...
55 LL |     m!(x);
56    |     ------ in this macro invocation
57    |
58    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
59
60 error: you checked before that `unwrap()` cannot fail, instead of checking and unwrapping, it's better to use `if let` or `match`
61   --> $DIR/simple_conditionals.rs:54:9
62    |
63 LL |     if x.is_ok() {
64    |        --------- the check is happening here
65 LL |         x.unwrap(); // unnecessary
66    |         ^^^^^^^^^^
67
68 error: this call to `unwrap_err()` will always panic
69   --> $DIR/simple_conditionals.rs:55:9
70    |
71 LL |     if x.is_ok() {
72    |        --------- because of this check
73 LL |         x.unwrap(); // unnecessary
74 LL |         x.unwrap_err(); // will panic
75    |         ^^^^^^^^^^^^^^
76
77 error: this call to `unwrap()` will always panic
78   --> $DIR/simple_conditionals.rs:57:9
79    |
80 LL |     if x.is_ok() {
81    |        --------- because of this check
82 ...
83 LL |         x.unwrap(); // will panic
84    |         ^^^^^^^^^^
85
86 error: you checked before that `unwrap_err()` cannot fail, instead of checking and unwrapping, it's better to use `if let` or `match`
87   --> $DIR/simple_conditionals.rs:58:9
88    |
89 LL |     if x.is_ok() {
90    |        --------- the check is happening here
91 ...
92 LL |         x.unwrap_err(); // unnecessary
93    |         ^^^^^^^^^^^^^^
94
95 error: this call to `unwrap()` will always panic
96   --> $DIR/simple_conditionals.rs:61:9
97    |
98 LL |     if x.is_err() {
99    |        ---------- because of this check
100 LL |         x.unwrap(); // will panic
101    |         ^^^^^^^^^^
102
103 error: you checked before that `unwrap_err()` cannot fail, instead of checking and unwrapping, it's better to use `if let` or `match`
104   --> $DIR/simple_conditionals.rs:62:9
105    |
106 LL |     if x.is_err() {
107    |        ---------- the check is happening here
108 LL |         x.unwrap(); // will panic
109 LL |         x.unwrap_err(); // unnecessary
110    |         ^^^^^^^^^^^^^^
111
112 error: you checked before that `unwrap()` cannot fail, instead of checking and unwrapping, it's better to use `if let` or `match`
113   --> $DIR/simple_conditionals.rs:64:9
114    |
115 LL |     if x.is_err() {
116    |        ---------- the check is happening here
117 ...
118 LL |         x.unwrap(); // unnecessary
119    |         ^^^^^^^^^^
120
121 error: this call to `unwrap_err()` will always panic
122   --> $DIR/simple_conditionals.rs:65:9
123    |
124 LL |     if x.is_err() {
125    |        ---------- because of this check
126 ...
127 LL |         x.unwrap_err(); // will panic
128    |         ^^^^^^^^^^^^^^
129
130 error: aborting due to 13 previous errors
131