]> git.lizzy.rs Git - rust.git/blob - tests/ui/matches.stderr
Merge #3387
[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: Err(_) will match all errors, maybe not a good idea
92   --> $DIR/matches.rs:83:9
93    |
94 83 |         Err(_) => panic!("err")
95    |         ^^^^^^
96    |
97    = note: `-D clippy::match-wild-err-arm` implied by `-D warnings`
98    = note: to remove this warning, match each error separately or use unreachable macro
99
100 error: this `match` has identical arm bodies
101   --> $DIR/matches.rs:82:18
102    |
103 82 |         Ok(_) => println!("ok"),
104    |                  ^^^^^^^^^^^^^^
105    |
106    = note: `-D clippy::match-same-arms` implied by `-D warnings`
107 note: same as this
108   --> $DIR/matches.rs:81:18
109    |
110 81 |         Ok(3) => println!("ok"),
111    |                  ^^^^^^^^^^^^^^
112 note: consider refactoring into `Ok(3) | Ok(_)`
113   --> $DIR/matches.rs:81:18
114    |
115 81 |         Ok(3) => println!("ok"),
116    |                  ^^^^^^^^^^^^^^
117    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
118
119 error: Err(_) will match all errors, maybe not a good idea
120   --> $DIR/matches.rs:89:9
121    |
122 89 |         Err(_) => {panic!()}
123    |         ^^^^^^
124    |
125    = note: to remove this warning, match each error separately or use unreachable macro
126
127 error: this `match` has identical arm bodies
128   --> $DIR/matches.rs:88:18
129    |
130 88 |         Ok(_) => println!("ok"),
131    |                  ^^^^^^^^^^^^^^
132    |
133 note: same as this
134   --> $DIR/matches.rs:87:18
135    |
136 87 |         Ok(3) => println!("ok"),
137    |                  ^^^^^^^^^^^^^^
138 note: consider refactoring into `Ok(3) | Ok(_)`
139   --> $DIR/matches.rs:87:18
140    |
141 87 |         Ok(3) => println!("ok"),
142    |                  ^^^^^^^^^^^^^^
143    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
144
145 error: Err(_) will match all errors, maybe not a good idea
146   --> $DIR/matches.rs:95:9
147    |
148 95 |         Err(_) => {panic!();}
149    |         ^^^^^^
150    |
151    = note: to remove this warning, match each error separately or use unreachable macro
152
153 error: this `match` has identical arm bodies
154   --> $DIR/matches.rs:94:18
155    |
156 94 |         Ok(_) => println!("ok"),
157    |                  ^^^^^^^^^^^^^^
158    |
159 note: same as this
160   --> $DIR/matches.rs:93:18
161    |
162 93 |         Ok(3) => println!("ok"),
163    |                  ^^^^^^^^^^^^^^
164 note: consider refactoring into `Ok(3) | Ok(_)`
165   --> $DIR/matches.rs:93:18
166    |
167 93 |         Ok(3) => println!("ok"),
168    |                  ^^^^^^^^^^^^^^
169    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
170
171 error: this `match` has identical arm bodies
172    --> $DIR/matches.rs:101:18
173     |
174 101 |         Ok(_) => println!("ok"),
175     |                  ^^^^^^^^^^^^^^
176     |
177 note: same as this
178    --> $DIR/matches.rs:100:18
179     |
180 100 |         Ok(3) => println!("ok"),
181     |                  ^^^^^^^^^^^^^^
182 note: consider refactoring into `Ok(3) | Ok(_)`
183    --> $DIR/matches.rs:100:18
184     |
185 100 |         Ok(3) => println!("ok"),
186     |                  ^^^^^^^^^^^^^^
187     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
188
189 error: this `match` has identical arm bodies
190    --> $DIR/matches.rs:108:18
191     |
192 108 |         Ok(_) => println!("ok"),
193     |                  ^^^^^^^^^^^^^^
194     |
195 note: same as this
196    --> $DIR/matches.rs:107:18
197     |
198 107 |         Ok(3) => println!("ok"),
199     |                  ^^^^^^^^^^^^^^
200 note: consider refactoring into `Ok(3) | Ok(_)`
201    --> $DIR/matches.rs:107:18
202     |
203 107 |         Ok(3) => println!("ok"),
204     |                  ^^^^^^^^^^^^^^
205     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
206
207 error: this `match` has identical arm bodies
208    --> $DIR/matches.rs:114:18
209     |
210 114 |         Ok(_) => println!("ok"),
211     |                  ^^^^^^^^^^^^^^
212     |
213 note: same as this
214    --> $DIR/matches.rs:113:18
215     |
216 113 |         Ok(3) => println!("ok"),
217     |                  ^^^^^^^^^^^^^^
218 note: consider refactoring into `Ok(3) | Ok(_)`
219    --> $DIR/matches.rs:113:18
220     |
221 113 |         Ok(3) => println!("ok"),
222     |                  ^^^^^^^^^^^^^^
223     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
224
225 error: this `match` has identical arm bodies
226    --> $DIR/matches.rs:120:18
227     |
228 120 |         Ok(_) => println!("ok"),
229     |                  ^^^^^^^^^^^^^^
230     |
231 note: same as this
232    --> $DIR/matches.rs:119:18
233     |
234 119 |         Ok(3) => println!("ok"),
235     |                  ^^^^^^^^^^^^^^
236 note: consider refactoring into `Ok(3) | Ok(_)`
237    --> $DIR/matches.rs:119:18
238     |
239 119 |         Ok(3) => println!("ok"),
240     |                  ^^^^^^^^^^^^^^
241     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
242
243 error: this `match` has identical arm bodies
244    --> $DIR/matches.rs:141:29
245     |
246 141 |         (Ok(_), Some(x)) => println!("ok {}", x),
247     |                             ^^^^^^^^^^^^^^^^^^^^
248     |
249 note: same as this
250    --> $DIR/matches.rs:140:29
251     |
252 140 |         (Ok(x), Some(_)) => println!("ok {}", x),
253     |                             ^^^^^^^^^^^^^^^^^^^^
254 note: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))`
255    --> $DIR/matches.rs:140:29
256     |
257 140 |         (Ok(x), Some(_)) => println!("ok {}", x),
258     |                             ^^^^^^^^^^^^^^^^^^^^
259     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
260
261 error: this `match` has identical arm bodies
262    --> $DIR/matches.rs:156:18
263     |
264 156 |         Ok(_) => println!("ok"),
265     |                  ^^^^^^^^^^^^^^
266     |
267 note: same as this
268    --> $DIR/matches.rs:155:18
269     |
270 155 |         Ok(3) => println!("ok"),
271     |                  ^^^^^^^^^^^^^^
272 note: consider refactoring into `Ok(3) | Ok(_)`
273    --> $DIR/matches.rs:155:18
274     |
275 155 |         Ok(3) => println!("ok"),
276     |                  ^^^^^^^^^^^^^^
277     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
278
279 error: use as_ref() instead
280    --> $DIR/matches.rs:163:33
281     |
282 163 |       let borrowed: Option<&()> = match owned {
283     |  _________________________________^
284 164 | |         None => None,
285 165 | |         Some(ref v) => Some(v),
286 166 | |     };
287     | |_____^ help: try this: `owned.as_ref()`
288     |
289     = note: `-D clippy::match-as-ref` implied by `-D warnings`
290
291 error: use as_mut() instead
292    --> $DIR/matches.rs:169:39
293     |
294 169 |       let borrow_mut: Option<&mut ()> = match mut_owned {
295     |  _______________________________________^
296 170 | |         None => None,
297 171 | |         Some(ref mut v) => Some(v),
298 172 | |     };
299     | |_____^ help: try this: `mut_owned.as_mut()`
300
301 error: aborting due to 21 previous errors
302