summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr
blob: ef68827422233e2de992d615c047802bf23cbdad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
error: called `unwrap` on `x` after checking its variant with `is_some`
  --> $DIR/simple_conditionals.rs:40:9
   |
LL |     if x.is_some() {
   |     -------------- help: try: `if let Some(..) = x`
LL |         x.unwrap(); // unnecessary
   |         ^^^^^^^^^^
   |
note: the lint level is defined here
  --> $DIR/simple_conditionals.rs:2:35
   |
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: called `expect` on `x` after checking its variant with `is_some`
  --> $DIR/simple_conditionals.rs:41:9
   |
LL |     if x.is_some() {
   |     -------------- help: try: `if let Some(..) = x`
LL |         x.unwrap(); // unnecessary
LL |         x.expect("an error message"); // unnecessary
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: this call to `unwrap()` will always panic
  --> $DIR/simple_conditionals.rs:43: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:2:9
   |
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^

error: this call to `expect()` will always panic
  --> $DIR/simple_conditionals.rs:44: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:47:9
   |
LL |     if x.is_none() {
   |        ----------- because of this check
LL |         x.unwrap(); // will panic
   |         ^^^^^^^^^^

error: called `unwrap` on `x` after checking its variant with `is_none`
  --> $DIR/simple_conditionals.rs:49:9
   |
LL |     if x.is_none() {
   |     -------------- help: try: `if let Some(..) = x`
...
LL |         x.unwrap(); // unnecessary
   |         ^^^^^^^^^^

error: called `unwrap` on `x` after checking its variant with `is_some`
  --> $DIR/simple_conditionals.rs:8:13
   |
LL |         if $a.is_some() {
   |         --------------- help: try: `if let Some(..) = x`
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: called `unwrap` on `x` after checking its variant with `is_ok`
  --> $DIR/simple_conditionals.rs:57:9
   |
LL |     if x.is_ok() {
   |     ------------ help: try: `if let Ok(..) = x`
LL |         x.unwrap(); // unnecessary
   |         ^^^^^^^^^^

error: called `expect` on `x` after checking its variant with `is_ok`
  --> $DIR/simple_conditionals.rs:58:9
   |
LL |     if x.is_ok() {
   |     ------------ help: try: `if let Ok(..) = x`
LL |         x.unwrap(); // unnecessary
LL |         x.expect("an error message"); // unnecessary
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: this call to `unwrap_err()` will always panic
  --> $DIR/simple_conditionals.rs:59: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:61: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:62:9
   |
LL |     if x.is_ok() {
   |        --------- because of this check
...
LL |         x.expect("an error message"); // will panic
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: called `unwrap_err` on `x` after checking its variant with `is_ok`
  --> $DIR/simple_conditionals.rs:63:9
   |
LL |     if x.is_ok() {
   |     ------------ help: try: `if let Err(..) = x`
...
LL |         x.unwrap_err(); // unnecessary
   |         ^^^^^^^^^^^^^^

error: this call to `unwrap()` will always panic
  --> $DIR/simple_conditionals.rs:66:9
   |
LL |     if x.is_err() {
   |        ---------- because of this check
LL |         x.unwrap(); // will panic
   |         ^^^^^^^^^^

error: called `unwrap_err` on `x` after checking its variant with `is_err`
  --> $DIR/simple_conditionals.rs:67:9
   |
LL |     if x.is_err() {
   |     ------------- help: try: `if let Err(..) = x`
LL |         x.unwrap(); // will panic
LL |         x.unwrap_err(); // unnecessary
   |         ^^^^^^^^^^^^^^

error: called `unwrap` on `x` after checking its variant with `is_err`
  --> $DIR/simple_conditionals.rs:69:9
   |
LL |     if x.is_err() {
   |     ------------- help: try: `if let Ok(..) = x`
...
LL |         x.unwrap(); // unnecessary
   |         ^^^^^^^^^^

error: this call to `unwrap_err()` will always panic
  --> $DIR/simple_conditionals.rs:70:9
   |
LL |     if x.is_err() {
   |        ---------- because of this check
...
LL |         x.unwrap_err(); // will panic
   |         ^^^^^^^^^^^^^^

error: aborting due to 17 previous errors