]> git.lizzy.rs Git - rust.git/blob - tests/ui/matches.stderr
Don't expand macro in single_match suggestion
[rust.git] / tests / ui / matches.stderr
1 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
2   --> $DIR/matches.rs:31:5
3    |
4 31 | /     match ExprNode::Butterflies {
5 32 | |         ExprNode::ExprAddrOf => Some(&NODE),
6 33 | |         _ => { let x = 5; None },
7 34 | |     }
8    | |_____^ help: try this: `if let ExprNode::ExprAddrOf = ExprNode::Butterflies { Some(&NODE) } else { let x = 5; None }`
9    |
10    = note: `-D clippy::single-match-else` implied by `-D warnings`
11
12 error: you don't need to add `&` to all patterns
13   --> $DIR/matches.rs:40:9
14    |
15 40 | /         match v {
16 41 | |             &Some(v) => println!("{:?}", v),
17 42 | |             &None => println!("none"),
18 43 | |         }
19    | |_________^
20    |
21    = note: `-D clippy::match-ref-pats` implied by `-D warnings`
22 help: instead of prefixing all patterns with `&`, you can dereference the expression
23    |
24 40 |         match *v {
25 41 |             Some(v) => println!("{:?}", v),
26 42 |             None => println!("none"),
27    |
28
29 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
30   --> $DIR/matches.rs:50:5
31    |
32 50 | /     match tup {
33 51 | |         &(v, 1) => println!("{}", v),
34 52 | |         _ => println!("none"),
35 53 | |     }
36    | |_____^ help: try this: `if let &(v, 1) = tup { println!("{}", v) } else { println!("none") }`
37
38 error: you don't need to add `&` to all patterns
39   --> $DIR/matches.rs:50:5
40    |
41 50 | /     match tup {
42 51 | |         &(v, 1) => println!("{}", v),
43 52 | |         _ => println!("none"),
44 53 | |     }
45    | |_____^
46 help: instead of prefixing all patterns with `&`, you can dereference the expression
47    |
48 50 |     match *tup {
49 51 |         (v, 1) => println!("{}", v),
50    |
51
52 error: you don't need to add `&` to both the expression and the patterns
53   --> $DIR/matches.rs:56:5
54    |
55 56 | /     match &w {
56 57 | |         &Some(v) => println!("{:?}", v),
57 58 | |         &None => println!("none"),
58 59 | |     }
59    | |_____^
60 help: try
61    |
62 56 |     match w {
63 57 |         Some(v) => println!("{:?}", v),
64 58 |         None => println!("none"),
65    |
66
67 error: you don't need to add `&` to all patterns
68   --> $DIR/matches.rs:67:5
69    |
70 67 | /     if let &None = a {
71 68 | |         println!("none");
72 69 | |     }
73    | |_____^
74 help: instead of prefixing all patterns with `&`, you can dereference the expression
75    |
76 67 |     if let None = *a {
77    |            ^^^^   ^^
78
79 error: you don't need to add `&` to both the expression and the patterns
80   --> $DIR/matches.rs:72:5
81    |
82 72 | /     if let &None = &b {
83 73 | |         println!("none");
84 74 | |     }
85    | |_____^
86 help: try
87    |
88 72 |     if let None = b {
89    |            ^^^^   ^
90
91 error: some ranges overlap
92   --> $DIR/matches.rs:81:9
93    |
94 81 |         0 ... 10 => println!("0 ... 10"),
95    |         ^^^^^^^^
96    |
97    = note: `-D clippy::match-overlapping-arm` implied by `-D warnings`
98 note: overlaps with this
99   --> $DIR/matches.rs:82:9
100    |
101 82 |         0 ... 11 => println!("0 ... 11"),
102    |         ^^^^^^^^
103
104 error: some ranges overlap
105   --> $DIR/matches.rs:87:9
106    |
107 87 |         0 ... 5 => println!("0 ... 5"),
108    |         ^^^^^^^
109    |
110 note: overlaps with this
111   --> $DIR/matches.rs:89:9
112    |
113 89 |         FOO ... 11 => println!("0 ... 11"),
114    |         ^^^^^^^^^^
115
116 error: some ranges overlap
117   --> $DIR/matches.rs:95:9
118    |
119 95 |         0 ... 5 => println!("0 ... 5"),
120    |         ^^^^^^^
121    |
122 note: overlaps with this
123   --> $DIR/matches.rs:94:9
124    |
125 94 |         2 => println!("2"),
126    |         ^
127
128 error: some ranges overlap
129    --> $DIR/matches.rs:101:9
130     |
131 101 |         0 ... 2 => println!("0 ... 2"),
132     |         ^^^^^^^
133     |
134 note: overlaps with this
135    --> $DIR/matches.rs:100:9
136     |
137 100 |         2 => println!("2"),
138     |         ^
139
140 error: some ranges overlap
141    --> $DIR/matches.rs:124:9
142     |
143 124 |         0 .. 11 => println!("0 .. 11"),
144     |         ^^^^^^^
145     |
146 note: overlaps with this
147    --> $DIR/matches.rs:125:9
148     |
149 125 |         0 ... 11 => println!("0 ... 11"),
150     |         ^^^^^^^^
151
152 error: Err(_) will match all errors, maybe not a good idea
153    --> $DIR/matches.rs:142:9
154     |
155 142 |         Err(_) => panic!("err")
156     |         ^^^^^^
157     |
158     = note: `-D clippy::match-wild-err-arm` implied by `-D warnings`
159     = note: to remove this warning, match each error separately or use unreachable macro
160
161 error: this `match` has identical arm bodies
162    --> $DIR/matches.rs:141:18
163     |
164 141 |         Ok(_) => println!("ok"),
165     |                  ^^^^^^^^^^^^^^
166     |
167     = note: `-D clippy::match-same-arms` implied by `-D warnings`
168 note: same as this
169    --> $DIR/matches.rs:140:18
170     |
171 140 |         Ok(3) => println!("ok"),
172     |                  ^^^^^^^^^^^^^^
173 note: consider refactoring into `Ok(3) | Ok(_)`
174    --> $DIR/matches.rs:140:18
175     |
176 140 |         Ok(3) => println!("ok"),
177     |                  ^^^^^^^^^^^^^^
178     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
179
180 error: Err(_) will match all errors, maybe not a good idea
181    --> $DIR/matches.rs:148:9
182     |
183 148 |         Err(_) => {panic!()}
184     |         ^^^^^^
185     |
186     = note: to remove this warning, match each error separately or use unreachable macro
187
188 error: this `match` has identical arm bodies
189    --> $DIR/matches.rs:147:18
190     |
191 147 |         Ok(_) => println!("ok"),
192     |                  ^^^^^^^^^^^^^^
193     |
194 note: same as this
195    --> $DIR/matches.rs:146:18
196     |
197 146 |         Ok(3) => println!("ok"),
198     |                  ^^^^^^^^^^^^^^
199 note: consider refactoring into `Ok(3) | Ok(_)`
200    --> $DIR/matches.rs:146:18
201     |
202 146 |         Ok(3) => println!("ok"),
203     |                  ^^^^^^^^^^^^^^
204     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
205
206 error: Err(_) will match all errors, maybe not a good idea
207    --> $DIR/matches.rs:154:9
208     |
209 154 |         Err(_) => {panic!();}
210     |         ^^^^^^
211     |
212     = note: to remove this warning, match each error separately or use unreachable macro
213
214 error: this `match` has identical arm bodies
215    --> $DIR/matches.rs:153:18
216     |
217 153 |         Ok(_) => println!("ok"),
218     |                  ^^^^^^^^^^^^^^
219     |
220 note: same as this
221    --> $DIR/matches.rs:152:18
222     |
223 152 |         Ok(3) => println!("ok"),
224     |                  ^^^^^^^^^^^^^^
225 note: consider refactoring into `Ok(3) | Ok(_)`
226    --> $DIR/matches.rs:152:18
227     |
228 152 |         Ok(3) => println!("ok"),
229     |                  ^^^^^^^^^^^^^^
230     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
231
232 error: this `match` has identical arm bodies
233    --> $DIR/matches.rs:160:18
234     |
235 160 |         Ok(_) => println!("ok"),
236     |                  ^^^^^^^^^^^^^^
237     |
238 note: same as this
239    --> $DIR/matches.rs:159:18
240     |
241 159 |         Ok(3) => println!("ok"),
242     |                  ^^^^^^^^^^^^^^
243 note: consider refactoring into `Ok(3) | Ok(_)`
244    --> $DIR/matches.rs:159:18
245     |
246 159 |         Ok(3) => println!("ok"),
247     |                  ^^^^^^^^^^^^^^
248     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
249
250 error: this `match` has identical arm bodies
251    --> $DIR/matches.rs:167:18
252     |
253 167 |         Ok(_) => println!("ok"),
254     |                  ^^^^^^^^^^^^^^
255     |
256 note: same as this
257    --> $DIR/matches.rs:166:18
258     |
259 166 |         Ok(3) => println!("ok"),
260     |                  ^^^^^^^^^^^^^^
261 note: consider refactoring into `Ok(3) | Ok(_)`
262    --> $DIR/matches.rs:166:18
263     |
264 166 |         Ok(3) => println!("ok"),
265     |                  ^^^^^^^^^^^^^^
266     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
267
268 error: this `match` has identical arm bodies
269    --> $DIR/matches.rs:173:18
270     |
271 173 |         Ok(_) => println!("ok"),
272     |                  ^^^^^^^^^^^^^^
273     |
274 note: same as this
275    --> $DIR/matches.rs:172:18
276     |
277 172 |         Ok(3) => println!("ok"),
278     |                  ^^^^^^^^^^^^^^
279 note: consider refactoring into `Ok(3) | Ok(_)`
280    --> $DIR/matches.rs:172:18
281     |
282 172 |         Ok(3) => println!("ok"),
283     |                  ^^^^^^^^^^^^^^
284     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
285
286 error: this `match` has identical arm bodies
287    --> $DIR/matches.rs:179:18
288     |
289 179 |         Ok(_) => println!("ok"),
290     |                  ^^^^^^^^^^^^^^
291     |
292 note: same as this
293    --> $DIR/matches.rs:178:18
294     |
295 178 |         Ok(3) => println!("ok"),
296     |                  ^^^^^^^^^^^^^^
297 note: consider refactoring into `Ok(3) | Ok(_)`
298    --> $DIR/matches.rs:178:18
299     |
300 178 |         Ok(3) => println!("ok"),
301     |                  ^^^^^^^^^^^^^^
302     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
303
304 error: this `match` has identical arm bodies
305    --> $DIR/matches.rs:200:29
306     |
307 200 |         (Ok(_), Some(x)) => println!("ok {}", x),
308     |                             ^^^^^^^^^^^^^^^^^^^^
309     |
310 note: same as this
311    --> $DIR/matches.rs:199:29
312     |
313 199 |         (Ok(x), Some(_)) => println!("ok {}", x),
314     |                             ^^^^^^^^^^^^^^^^^^^^
315 note: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))`
316    --> $DIR/matches.rs:199:29
317     |
318 199 |         (Ok(x), Some(_)) => println!("ok {}", x),
319     |                             ^^^^^^^^^^^^^^^^^^^^
320     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
321
322 error: this `match` has identical arm bodies
323    --> $DIR/matches.rs:215:18
324     |
325 215 |         Ok(_) => println!("ok"),
326     |                  ^^^^^^^^^^^^^^
327     |
328 note: same as this
329    --> $DIR/matches.rs:214:18
330     |
331 214 |         Ok(3) => println!("ok"),
332     |                  ^^^^^^^^^^^^^^
333 note: consider refactoring into `Ok(3) | Ok(_)`
334    --> $DIR/matches.rs:214:18
335     |
336 214 |         Ok(3) => println!("ok"),
337     |                  ^^^^^^^^^^^^^^
338     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
339
340 error: use as_ref() instead
341    --> $DIR/matches.rs:222:33
342     |
343 222 |       let borrowed: Option<&()> = match owned {
344     |  _________________________________^
345 223 | |         None => None,
346 224 | |         Some(ref v) => Some(v),
347 225 | |     };
348     | |_____^ help: try this: `owned.as_ref()`
349     |
350     = note: `-D clippy::match-as-ref` implied by `-D warnings`
351
352 error: use as_mut() instead
353    --> $DIR/matches.rs:228:39
354     |
355 228 |       let borrow_mut: Option<&mut ()> = match mut_owned {
356     |  _______________________________________^
357 229 | |         None => None,
358 230 | |         Some(ref mut v) => Some(v),
359 231 | |     };
360     | |_____^ help: try this: `mut_owned.as_mut()`
361
362 error: aborting due to 26 previous errors
363