]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/single_match_else.stderr
Rollup merge of #100396 - chenyukang:fix-100394, r=petrochenkov
[rust.git] / src / tools / clippy / tests / ui / single_match_else.stderr
1 error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
2   --> $DIR/single_match_else.rs:19:13
3    |
4 LL |       let _ = match ExprNode::Butterflies {
5    |  _____________^
6 LL | |         ExprNode::ExprAddrOf => Some(&NODE),
7 LL | |         _ => {
8 LL | |             let x = 5;
9 LL | |             None
10 LL | |         },
11 LL | |     };
12    | |_____^
13    |
14    = note: `-D clippy::single-match-else` implied by `-D warnings`
15 help: try this
16    |
17 LL ~     let _ = if let ExprNode::ExprAddrOf = ExprNode::Butterflies { Some(&NODE) } else {
18 LL +         let x = 5;
19 LL +         None
20 LL ~     };
21    |
22
23 error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
24   --> $DIR/single_match_else.rs:84:5
25    |
26 LL | /     match Some(1) {
27 LL | |         Some(a) => println!("${:?}", a),
28 LL | |         None => {
29 LL | |             println!("else block");
30 LL | |             return
31 LL | |         },
32 LL | |     }
33    | |_____^
34    |
35 help: try this
36    |
37 LL ~     if let Some(a) = Some(1) { println!("${:?}", a) } else {
38 LL +         println!("else block");
39 LL +         return
40 LL +     }
41    |
42
43 error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
44   --> $DIR/single_match_else.rs:93:5
45    |
46 LL | /     match Some(1) {
47 LL | |         Some(a) => println!("${:?}", a),
48 LL | |         None => {
49 LL | |             println!("else block");
50 LL | |             return;
51 LL | |         },
52 LL | |     }
53    | |_____^
54    |
55 help: try this
56    |
57 LL ~     if let Some(a) = Some(1) { println!("${:?}", a) } else {
58 LL +         println!("else block");
59 LL +         return;
60 LL +     }
61    |
62
63 error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
64   --> $DIR/single_match_else.rs:103:5
65    |
66 LL | /     match Result::<i32, Infallible>::Ok(1) {
67 LL | |         Ok(a) => println!("${:?}", a),
68 LL | |         Err(_) => {
69 LL | |             println!("else block");
70 LL | |             return;
71 LL | |         }
72 LL | |     }
73    | |_____^
74    |
75 help: try this
76    |
77 LL ~     if let Ok(a) = Result::<i32, Infallible>::Ok(1) { println!("${:?}", a) } else {
78 LL +         println!("else block");
79 LL +         return;
80 LL +     }
81    |
82
83 error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
84   --> $DIR/single_match_else.rs:112:5
85    |
86 LL | /     match Cow::from("moo") {
87 LL | |         Cow::Owned(a) => println!("${:?}", a),
88 LL | |         Cow::Borrowed(_) => {
89 LL | |             println!("else block");
90 LL | |             return;
91 LL | |         }
92 LL | |     }
93    | |_____^
94    |
95 help: try this
96    |
97 LL ~     if let Cow::Owned(a) = Cow::from("moo") { println!("${:?}", a) } else {
98 LL +         println!("else block");
99 LL +         return;
100 LL +     }
101    |
102
103 error: aborting due to 5 previous errors
104