summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/single_match.stderr
blob: d4b865995213905c325559fe07968b9bf84af728 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> $DIR/single_match.rs:14:5
   |
LL | /     match x {
LL | |         Some(y) => {
LL | |             println!("{:?}", y);
LL | |         },
LL | |         _ => (),
LL | |     };
   | |_____^
   |
   = note: `-D clippy::single-match` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::single_match)]`
help: try
   |
LL ~     if let Some(y) = x {
LL +         println!("{:?}", y);
LL ~     };
   |

error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> $DIR/single_match.rs:22:5
   |
LL | /     match x {
LL | |         // Note the missing block braces.
LL | |         // We suggest `if let Some(y) = x { .. }` because the macro
LL | |         // is expanded before we can do anything.
LL | |         Some(y) => println!("{:?}", y),
LL | |         _ => (),
LL | |     }
   | |_____^ help: try: `if let Some(y) = x { println!("{:?}", y) }`

error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> $DIR/single_match.rs:31:5
   |
LL | /     match z {
LL | |         (2..=3, 7..=9) => dummy(),
LL | |         _ => {},
LL | |     };
   | |_____^ help: try: `if let (2..=3, 7..=9) = z { dummy() }`

error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> $DIR/single_match.rs:60:5
   |
LL | /     match x {
LL | |         Some(y) => dummy(),
LL | |         None => (),
LL | |     };
   | |_____^ help: try: `if let Some(y) = x { dummy() }`

error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> $DIR/single_match.rs:65:5
   |
LL | /     match y {
LL | |         Ok(y) => dummy(),
LL | |         Err(..) => (),
LL | |     };
   | |_____^ help: try: `if let Ok(y) = y { dummy() }`

error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> $DIR/single_match.rs:72:5
   |
LL | /     match c {
LL | |         Cow::Borrowed(..) => dummy(),
LL | |         Cow::Owned(..) => (),
LL | |     };
   | |_____^ help: try: `if let Cow::Borrowed(..) = c { dummy() }`

error: you seem to be trying to use `match` for an equality check. Consider using `if`
  --> $DIR/single_match.rs:93:5
   |
LL | /     match x {
LL | |         "test" => println!(),
LL | |         _ => (),
LL | |     }
   | |_____^ help: try: `if x == "test" { println!() }`

error: you seem to be trying to use `match` for an equality check. Consider using `if`
  --> $DIR/single_match.rs:106:5
   |
LL | /     match x {
LL | |         Foo::A => println!(),
LL | |         _ => (),
LL | |     }
   | |_____^ help: try: `if x == Foo::A { println!() }`

error: you seem to be trying to use `match` for an equality check. Consider using `if`
  --> $DIR/single_match.rs:112:5
   |
LL | /     match x {
LL | |         FOO_C => println!(),
LL | |         _ => (),
LL | |     }
   | |_____^ help: try: `if x == FOO_C { println!() }`

error: you seem to be trying to use `match` for an equality check. Consider using `if`
  --> $DIR/single_match.rs:117:5
   |
LL | /     match &&x {
LL | |         Foo::A => println!(),
LL | |         _ => (),
LL | |     }
   | |_____^ help: try: `if x == Foo::A { println!() }`

error: you seem to be trying to use `match` for an equality check. Consider using `if`
  --> $DIR/single_match.rs:123:5
   |
LL | /     match &x {
LL | |         Foo::A => println!(),
LL | |         _ => (),
LL | |     }
   | |_____^ help: try: `if x == &Foo::A { println!() }`

error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> $DIR/single_match.rs:140:5
   |
LL | /     match x {
LL | |         Bar::A => println!(),
LL | |         _ => (),
LL | |     }
   | |_____^ help: try: `if let Bar::A = x { println!() }`

error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> $DIR/single_match.rs:148:5
   |
LL | /     match x {
LL | |         None => println!(),
LL | |         _ => (),
LL | |     };
   | |_____^ help: try: `if let None = x { println!() }`

error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> $DIR/single_match.rs:170:5
   |
LL | /     match x {
LL | |         (Some(_), _) => {},
LL | |         (None, _) => {},
LL | |     }
   | |_____^ help: try: `if let (Some(_), _) = x {}`

error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> $DIR/single_match.rs:176:5
   |
LL | /     match x {
LL | |         (Some(E::V), _) => todo!(),
LL | |         (_, _) => {},
LL | |     }
   | |_____^ help: try: `if let (Some(E::V), _) = x { todo!() }`

error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> $DIR/single_match.rs:182:5
   |
LL | /     match (Some(42), Some(E::V), Some(42)) {
LL | |         (.., Some(E::V), _) => {},
LL | |         (..) => {},
LL | |     }
   | |_____^ help: try: `if let (.., Some(E::V), _) = (Some(42), Some(E::V), Some(42)) {}`

error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> $DIR/single_match.rs:254:5
   |
LL | /     match bar {
LL | |         Some(v) => unsafe {
LL | |             let r = &v as *const i32;
LL | |             println!("{}", *r);
LL | |         },
LL | |         _ => {},
LL | |     }
   | |_____^
   |
help: try
   |
LL ~     if let Some(v) = bar { unsafe {
LL +         let r = &v as *const i32;
LL +         println!("{}", *r);
LL +     } }
   |

error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> $DIR/single_match.rs:262:5
   |
LL | /     match bar {
LL | |         #[rustfmt::skip]
LL | |         Some(v) => {
LL | |             unsafe {
...  |
LL | |         _ => {},
LL | |     }
   | |_____^
   |
help: try
   |
LL ~     if let Some(v) = bar {
LL +         unsafe {
LL +             let r = &v as *const i32;
LL +             println!("{}", *r);
LL +         }
LL +     }
   |

error: aborting due to 18 previous errors