]> git.lizzy.rs Git - rust.git/blob - tests/ui/matches.stderr
Adapt the *.stderr files of the ui-tests to the tool_lints
[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:21:5
3    |
4 21 | /     match ExprNode::Butterflies {
5 22 | |         ExprNode::ExprAddrOf => Some(&NODE),
6 23 | |         _ => { let x = 5; None },
7 24 | |     }
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:30:9
14    |
15 30 | /         match v {
16 31 | |             &Some(v) => println!("{:?}", v),
17 32 | |             &None => println!("none"),
18 33 | |         }
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 30 |         match *v {
25 31 |             Some(v) => println!("{:?}", v),
26 32 |             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:40:5
31    |
32 40 | /     match tup {
33 41 | |         &(v, 1) => println!("{}", v),
34 42 | |         _ => println!("none"),
35 43 | |     }
36    | |_____^ help: try this: `if let &(v, 1) = tup { $ crate :: io :: _print ( format_args_nl ! ( $ ( $ arg ) * ) ) ; } else { $ crate :: io :: _print ( format_args_nl ! ( $ ( $ arg ) * ) ) ; }`
37
38 error: you don't need to add `&` to all patterns
39   --> $DIR/matches.rs:40:5
40    |
41 40 | /     match tup {
42 41 | |         &(v, 1) => println!("{}", v),
43 42 | |         _ => println!("none"),
44 43 | |     }
45    | |_____^
46 help: instead of prefixing all patterns with `&`, you can dereference the expression
47    |
48 40 |     match *tup {
49 41 |         (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:46:5
54    |
55 46 | /     match &w {
56 47 | |         &Some(v) => println!("{:?}", v),
57 48 | |         &None => println!("none"),
58 49 | |     }
59    | |_____^
60 help: try
61    |
62 46 |     match w {
63 47 |         Some(v) => println!("{:?}", v),
64 48 |         None => println!("none"),
65    |
66
67 error: you don't need to add `&` to all patterns
68   --> $DIR/matches.rs:57:5
69    |
70 57 | /     if let &None = a {
71 58 | |         println!("none");
72 59 | |     }
73    | |_____^
74 help: instead of prefixing all patterns with `&`, you can dereference the expression
75    |
76 57 |     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:62:5
81    |
82 62 | /     if let &None = &b {
83 63 | |         println!("none");
84 64 | |     }
85    | |_____^
86 help: try
87    |
88 62 |     if let None = b {
89    |            ^^^^   ^
90
91 error: some ranges overlap
92   --> $DIR/matches.rs:71:9
93    |
94 71 |         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:72:9
100    |
101 72 |         0 ... 11 => println!("0 ... 11"),
102    |         ^^^^^^^^
103
104 error: some ranges overlap
105   --> $DIR/matches.rs:77:9
106    |
107 77 |         0 ... 5 => println!("0 ... 5"),
108    |         ^^^^^^^
109    |
110 note: overlaps with this
111   --> $DIR/matches.rs:79:9
112    |
113 79 |         FOO ... 11 => println!("0 ... 11"),
114    |         ^^^^^^^^^^
115
116 error: some ranges overlap
117   --> $DIR/matches.rs:85:9
118    |
119 85 |         0 ... 5 => println!("0 ... 5"),
120    |         ^^^^^^^
121    |
122 note: overlaps with this
123   --> $DIR/matches.rs:84:9
124    |
125 84 |         2 => println!("2"),
126    |         ^
127
128 error: some ranges overlap
129   --> $DIR/matches.rs:91:9
130    |
131 91 |         0 ... 2 => println!("0 ... 2"),
132    |         ^^^^^^^
133    |
134 note: overlaps with this
135   --> $DIR/matches.rs:90:9
136    |
137 90 |         2 => println!("2"),
138    |         ^
139
140 error: some ranges overlap
141    --> $DIR/matches.rs:114:9
142     |
143 114 |         0 .. 11 => println!("0 .. 11"),
144     |         ^^^^^^^
145     |
146 note: overlaps with this
147    --> $DIR/matches.rs:115:9
148     |
149 115 |         0 ... 11 => println!("0 ... 11"),
150     |         ^^^^^^^^
151
152 error: Err(_) will match all errors, maybe not a good idea
153    --> $DIR/matches.rs:132:9
154     |
155 132 |         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:131:18
163     |
164 131 |         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:130:18
170     |
171 130 |         Ok(3) => println!("ok"),
172     |                  ^^^^^^^^^^^^^^
173 note: consider refactoring into `Ok(3) | Ok(_)`
174    --> $DIR/matches.rs:130:18
175     |
176 130 |         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:138:9
182     |
183 138 |         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:137:18
190     |
191 137 |         Ok(_) => println!("ok"),
192     |                  ^^^^^^^^^^^^^^
193     |
194 note: same as this
195    --> $DIR/matches.rs:136:18
196     |
197 136 |         Ok(3) => println!("ok"),
198     |                  ^^^^^^^^^^^^^^
199 note: consider refactoring into `Ok(3) | Ok(_)`
200    --> $DIR/matches.rs:136:18
201     |
202 136 |         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:144:9
208     |
209 144 |         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:143:18
216     |
217 143 |         Ok(_) => println!("ok"),
218     |                  ^^^^^^^^^^^^^^
219     |
220 note: same as this
221    --> $DIR/matches.rs:142:18
222     |
223 142 |         Ok(3) => println!("ok"),
224     |                  ^^^^^^^^^^^^^^
225 note: consider refactoring into `Ok(3) | Ok(_)`
226    --> $DIR/matches.rs:142:18
227     |
228 142 |         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:150:18
234     |
235 150 |         Ok(_) => println!("ok"),
236     |                  ^^^^^^^^^^^^^^
237     |
238 note: same as this
239    --> $DIR/matches.rs:149:18
240     |
241 149 |         Ok(3) => println!("ok"),
242     |                  ^^^^^^^^^^^^^^
243 note: consider refactoring into `Ok(3) | Ok(_)`
244    --> $DIR/matches.rs:149:18
245     |
246 149 |         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:157:18
252     |
253 157 |         Ok(_) => println!("ok"),
254     |                  ^^^^^^^^^^^^^^
255     |
256 note: same as this
257    --> $DIR/matches.rs:156:18
258     |
259 156 |         Ok(3) => println!("ok"),
260     |                  ^^^^^^^^^^^^^^
261 note: consider refactoring into `Ok(3) | Ok(_)`
262    --> $DIR/matches.rs:156:18
263     |
264 156 |         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:163:18
270     |
271 163 |         Ok(_) => println!("ok"),
272     |                  ^^^^^^^^^^^^^^
273     |
274 note: same as this
275    --> $DIR/matches.rs:162:18
276     |
277 162 |         Ok(3) => println!("ok"),
278     |                  ^^^^^^^^^^^^^^
279 note: consider refactoring into `Ok(3) | Ok(_)`
280    --> $DIR/matches.rs:162:18
281     |
282 162 |         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:169:18
288     |
289 169 |         Ok(_) => println!("ok"),
290     |                  ^^^^^^^^^^^^^^
291     |
292 note: same as this
293    --> $DIR/matches.rs:168:18
294     |
295 168 |         Ok(3) => println!("ok"),
296     |                  ^^^^^^^^^^^^^^
297 note: consider refactoring into `Ok(3) | Ok(_)`
298    --> $DIR/matches.rs:168:18
299     |
300 168 |         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:190:29
306     |
307 190 |         (Ok(_), Some(x)) => println!("ok {}", x),
308     |                             ^^^^^^^^^^^^^^^^^^^^
309     |
310 note: same as this
311    --> $DIR/matches.rs:189:29
312     |
313 189 |         (Ok(x), Some(_)) => println!("ok {}", x),
314     |                             ^^^^^^^^^^^^^^^^^^^^
315 note: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))`
316    --> $DIR/matches.rs:189:29
317     |
318 189 |         (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:205:18
324     |
325 205 |         Ok(_) => println!("ok"),
326     |                  ^^^^^^^^^^^^^^
327     |
328 note: same as this
329    --> $DIR/matches.rs:204:18
330     |
331 204 |         Ok(3) => println!("ok"),
332     |                  ^^^^^^^^^^^^^^
333 note: consider refactoring into `Ok(3) | Ok(_)`
334    --> $DIR/matches.rs:204:18
335     |
336 204 |         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:212:33
342     |
343 212 |       let borrowed: Option<&()> = match owned {
344     |  _________________________________^
345 213 | |         None => None,
346 214 | |         Some(ref v) => Some(v),
347 215 | |     };
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:218:39
354     |
355 218 |       let borrow_mut: Option<&mut ()> = match mut_owned {
356     |  _______________________________________^
357 219 | |         None => None,
358 220 | |         Some(ref mut v) => Some(v),
359 221 | |     };
360     | |_____^ help: try this: `mut_owned.as_mut()`
361
362 error: aborting due to 26 previous errors
363