fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
8.1 KiB318 linesraw
1error: this match could be written as a `let` statement
2  --> $DIR/match_single_binding.rs:33:5
3   |
4LL | /     match (a, b, c) {
5LL | |         (x, y, z) => {
6LL | |             println!("{} {} {}", x, y, z);
7LL | |         },
8LL | |     }
9   | |_____^
10   |
11   = note: `-D clippy::match-single-binding` implied by `-D warnings`
12   = help: to override `-D warnings` add `#[allow(clippy::match_single_binding)]`
13help: consider using a `let` statement
14   |
15LL ~     let (x, y, z) = (a, b, c);
16LL +     {
17LL +         println!("{} {} {}", x, y, z);
18LL +     }
19   |
20
21error: this match could be written as a `let` statement
22  --> $DIR/match_single_binding.rs:39:5
23   |
24LL | /     match (a, b, c) {
25LL | |         (x, y, z) => println!("{} {} {}", x, y, z),
26LL | |     }
27   | |_____^
28   |
29help: consider using a `let` statement
30   |
31LL ~     let (x, y, z) = (a, b, c);
32LL +     println!("{} {} {}", x, y, z);
33   |
34
35error: this match could be replaced by its body itself
36  --> $DIR/match_single_binding.rs:56:5
37   |
38LL | /     match a {
39LL | |         _ => println!("whatever"),
40LL | |     }
41   | |_____^ help: consider using the match body instead: `println!("whatever");`
42
43error: this match could be replaced by its body itself
44  --> $DIR/match_single_binding.rs:60:5
45   |
46LL | /     match a {
47LL | |         _ => {
48LL | |             let x = 29;
49LL | |             println!("x has a value of {}", x);
50LL | |         },
51LL | |     }
52   | |_____^
53   |
54help: consider using the match body instead
55   |
56LL ~     {
57LL +         let x = 29;
58LL +         println!("x has a value of {}", x);
59LL +     }
60   |
61
62error: this match could be replaced by its body itself
63  --> $DIR/match_single_binding.rs:67:5
64   |
65LL | /     match a {
66LL | |         _ => {
67LL | |             let e = 5 * a;
68LL | |             if e >= 5 {
69...  |
70LL | |         },
71LL | |     }
72   | |_____^
73   |
74help: consider using the match body instead
75   |
76LL ~     {
77LL +         let e = 5 * a;
78LL +         if e >= 5 {
79LL +             println!("e is superior to 5");
80LL +         }
81LL +     }
82   |
83
84error: this match could be written as a `let` statement
85  --> $DIR/match_single_binding.rs:77:5
86   |
87LL | /     match p {
88LL | |         Point { x, y } => println!("Coords: ({}, {})", x, y),
89LL | |     }
90   | |_____^
91   |
92help: consider using a `let` statement
93   |
94LL ~     let Point { x, y } = p;
95LL +     println!("Coords: ({}, {})", x, y);
96   |
97
98error: this match could be written as a `let` statement
99  --> $DIR/match_single_binding.rs:81:5
100   |
101LL | /     match p {
102LL | |         Point { x: x1, y: y1 } => println!("Coords: ({}, {})", x1, y1),
103LL | |     }
104   | |_____^
105   |
106help: consider using a `let` statement
107   |
108LL ~     let Point { x: x1, y: y1 } = p;
109LL +     println!("Coords: ({}, {})", x1, y1);
110   |
111
112error: this match could be written as a `let` statement
113  --> $DIR/match_single_binding.rs:86:5
114   |
115LL | /     match x {
116LL | |         ref r => println!("Got a reference to {}", r),
117LL | |     }
118   | |_____^
119   |
120help: consider using a `let` statement
121   |
122LL ~     let ref r = x;
123LL +     println!("Got a reference to {}", r);
124   |
125
126error: this match could be written as a `let` statement
127  --> $DIR/match_single_binding.rs:91:5
128   |
129LL | /     match x {
130LL | |         ref mut mr => println!("Got a mutable reference to {}", mr),
131LL | |     }
132   | |_____^
133   |
134help: consider using a `let` statement
135   |
136LL ~     let ref mut mr = x;
137LL +     println!("Got a mutable reference to {}", mr);
138   |
139
140error: this match could be written as a `let` statement
141  --> $DIR/match_single_binding.rs:95:5
142   |
143LL | /     let product = match coords() {
144LL | |         Point { x, y } => x * y,
145LL | |     };
146   | |______^
147   |
148help: consider using a `let` statement
149   |
150LL ~     let Point { x, y } = coords();
151LL +     let product = x * y;
152   |
153
154error: this match could be written as a `let` statement
155  --> $DIR/match_single_binding.rs:103:18
156   |
157LL |           .map(|i| match i.unwrap() {
158   |  __________________^
159LL | |             unwrapped => unwrapped,
160LL | |         })
161   | |_________^
162   |
163help: consider using a `let` statement
164   |
165LL ~         .map(|i| {
166LL +             let unwrapped = i.unwrap();
167LL +             unwrapped
168LL ~         })
169   |
170
171error: this match could be replaced by its body itself
172  --> $DIR/match_single_binding.rs:129:5
173   |
174LL | /     match x {
175LL | |         // =>
176LL | |         _ => println!("Not an array index start"),
177LL | |     }
178   | |_____^ help: consider using the match body instead: `println!("Not an array index start")`
179
180error: this assignment could be simplified
181  --> $DIR/match_single_binding.rs:138:5
182   |
183LL | /     val = match val.split_at(idx) {
184LL | |         (pre, suf) => {
185LL | |             println!("{}", pre);
186LL | |             suf
187LL | |         },
188LL | |     };
189   | |_____^
190   |
191help: consider removing the `match` expression
192   |
193LL ~     let (pre, suf) = val.split_at(idx);
194LL +     val = {
195LL +         println!("{}", pre);
196LL +         suf
197LL ~     };
198   |
199
200error: this match could be replaced by its scrutinee and body
201  --> $DIR/match_single_binding.rs:151:16
202   |
203LL |       let _ = || match side_effects() {
204   |  ________________^
205LL | |         _ => println!("Needs curlies"),
206LL | |     };
207   | |_____^
208   |
209help: consider using the scrutinee and body instead
210   |
211LL ~     let _ = || {
212LL +         side_effects();
213LL +         println!("Needs curlies")
214LL ~     };
215   |
216
217error: this match could be written as a `let` statement
218  --> $DIR/match_single_binding.rs:157:5
219   |
220LL | /     match r {
221LL | |         x => match x {
222LL | |             Some(_) => {
223LL | |                 println!("Some");
224...  |
225LL | |         },
226LL | |     };
227   | |_____^
228   |
229help: consider using a `let` statement
230   |
231LL ~     let x = r;
232LL +     match x {
233LL +         Some(_) => {
234LL +             println!("Some");
235LL +         },
236LL +         None => {
237LL +             println!("None");
238LL +         },
239LL ~     };
240   |
241
242error: this match could be replaced by its body itself
243  --> $DIR/match_single_binding.rs:170:5
244   |
245LL | /     match 1 {
246LL | |         _ => (),
247LL | |     }
248   | |_____^ help: consider using the match body instead: `();`
249
250error: this match could be replaced by its body itself
251  --> $DIR/match_single_binding.rs:174:13
252   |
253LL |       let a = match 1 {
254   |  _____________^
255LL | |         _ => (),
256LL | |     };
257   | |_____^ help: consider using the match body instead: `()`
258
259error: this match could be replaced by its body itself
260  --> $DIR/match_single_binding.rs:178:5
261   |
262LL | /     match 1 {
263LL | |         _ => side_effects(),
264LL | |     }
265   | |_____^ help: consider using the match body instead: `side_effects();`
266
267error: this match could be replaced by its body itself
268  --> $DIR/match_single_binding.rs:182:13
269   |
270LL |       let b = match 1 {
271   |  _____________^
272LL | |         _ => side_effects(),
273LL | |     };
274   | |_____^ help: consider using the match body instead: `side_effects()`
275
276error: this match could be replaced by its body itself
277  --> $DIR/match_single_binding.rs:186:5
278   |
279LL | /     match 1 {
280LL | |         _ => println!("1"),
281LL | |     }
282   | |_____^ help: consider using the match body instead: `println!("1");`
283
284error: this match could be replaced by its body itself
285  --> $DIR/match_single_binding.rs:190:13
286   |
287LL |       let c = match 1 {
288   |  _____________^
289LL | |         _ => println!("1"),
290LL | |     };
291   | |_____^ help: consider using the match body instead: `println!("1")`
292
293error: this match could be replaced by its body itself
294  --> $DIR/match_single_binding.rs:195:9
295   |
296LL | /         match 1 {
297LL | |             _ => (),
298LL | |         },
299   | |_________^ help: consider using the match body instead: `()`
300
301error: this match could be replaced by its body itself
302  --> $DIR/match_single_binding.rs:198:9
303   |
304LL | /         match 1 {
305LL | |             _ => side_effects(),
306LL | |         },
307   | |_________^ help: consider using the match body instead: `side_effects()`
308
309error: this match could be replaced by its body itself
310  --> $DIR/match_single_binding.rs:201:9
311   |
312LL | /         match 1 {
313LL | |             _ => println!("1"),
314LL | |         },
315   | |_________^ help: consider using the match body instead: `println!("1")`
316
317error: aborting due to 24 previous errors
318