]> git.lizzy.rs Git - rust.git/blob - tests/ui/single_match.stderr
iterate List by value
[rust.git] / tests / ui / single_match.stderr
1 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
2   --> $DIR/single_match.rs:8:5
3    |
4 LL | /     match x {
5 LL | |         Some(y) => {
6 LL | |             println!("{:?}", y);
7 LL | |         },
8 LL | |         _ => (),
9 LL | |     };
10    | |_____^
11    |
12    = note: `-D clippy::single-match` implied by `-D warnings`
13 help: try this
14    |
15 LL |     if let Some(y) = x {
16 LL |         println!("{:?}", y);
17 LL |     };
18    |
19
20 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
21   --> $DIR/single_match.rs:16:5
22    |
23 LL | /     match x {
24 LL | |         // Note the missing block braces.
25 LL | |         // We suggest `if let Some(y) = x { .. }` because the macro
26 LL | |         // is expanded before we can do anything.
27 LL | |         Some(y) => println!("{:?}", y),
28 LL | |         _ => (),
29 LL | |     }
30    | |_____^ help: try this: `if let Some(y) = x { println!("{:?}", y) }`
31
32 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
33   --> $DIR/single_match.rs:25:5
34    |
35 LL | /     match z {
36 LL | |         (2..=3, 7..=9) => dummy(),
37 LL | |         _ => {},
38 LL | |     };
39    | |_____^ help: try this: `if let (2..=3, 7..=9) = z { dummy() }`
40
41 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
42   --> $DIR/single_match.rs:54:5
43    |
44 LL | /     match x {
45 LL | |         Some(y) => dummy(),
46 LL | |         None => (),
47 LL | |     };
48    | |_____^ help: try this: `if let Some(y) = x { dummy() }`
49
50 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
51   --> $DIR/single_match.rs:59:5
52    |
53 LL | /     match y {
54 LL | |         Ok(y) => dummy(),
55 LL | |         Err(..) => (),
56 LL | |     };
57    | |_____^ help: try this: `if let Ok(y) = y { dummy() }`
58
59 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
60   --> $DIR/single_match.rs:66:5
61    |
62 LL | /     match c {
63 LL | |         Cow::Borrowed(..) => dummy(),
64 LL | |         Cow::Owned(..) => (),
65 LL | |     };
66    | |_____^ help: try this: `if let Cow::Borrowed(..) = c { dummy() }`
67
68 error: aborting due to 6 previous errors
69