@@ -152,14 +152,33 @@ LL | | vec![s.to_string()]
152
152
LL | | }
153
153
| |_____________^ help: try: `s.find('.').map_or_else(|| vec![s.to_string()], |idx| vec![s[..idx].to_string(), s[idx..].to_string()])`
154
154
155
+ error: use Option::map_or_else instead of an if let/else
156
+ --> $DIR/option_if_let_else.rs:120:5
157
+ |
158
+ LL | / if let Ok(binding) = variable {
159
+ LL | | println!("Ok {binding}");
160
+ LL | | } else {
161
+ LL | | println!("Err");
162
+ LL | | }
163
+ | |_____^
164
+ |
165
+ help: try
166
+ |
167
+ LL ~ variable.map_or_else(|_| {
168
+ LL + println!("Err");
169
+ LL + }, |binding| {
170
+ LL + println!("Ok {binding}");
171
+ LL + })
172
+ |
173
+
155
174
error: use Option::map_or instead of an if let/else
156
- --> $DIR/option_if_let_else.rs:133 :13
175
+ --> $DIR/option_if_let_else.rs:142 :13
157
176
|
158
177
LL | let _ = if let Some(x) = optional { x + 2 } else { 5 };
159
178
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `optional.map_or(5, |x| x + 2)`
160
179
161
180
error: use Option::map_or instead of an if let/else
162
- --> $DIR/option_if_let_else.rs:142 :13
181
+ --> $DIR/option_if_let_else.rs:152 :13
163
182
|
164
183
LL | let _ = if let Some(x) = Some(0) {
165
184
| _____________^
@@ -181,13 +200,13 @@ LL ~ });
181
200
|
182
201
183
202
error: use Option::map_or instead of an if let/else
184
- --> $DIR/option_if_let_else.rs:170 :13
203
+ --> $DIR/option_if_let_else.rs:180 :13
185
204
|
186
205
LL | let _ = if let Some(x) = Some(0) { s.len() + x } else { s.len() };
187
206
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(0).map_or(s.len(), |x| s.len() + x)`
188
207
189
208
error: use Option::map_or instead of an if let/else
190
- --> $DIR/option_if_let_else.rs:174 :13
209
+ --> $DIR/option_if_let_else.rs:184 :13
191
210
|
192
211
LL | let _ = if let Some(x) = Some(0) {
193
212
| _____________^
@@ -207,7 +226,7 @@ LL ~ });
207
226
|
208
227
209
228
error: use Option::map_or instead of an if let/else
210
- --> $DIR/option_if_let_else.rs:213 :13
229
+ --> $DIR/option_if_let_else.rs:223 :13
211
230
|
212
231
LL | let _ = match s {
213
232
| _____________^
@@ -217,7 +236,7 @@ LL | | };
217
236
| |_____^ help: try: `s.map_or(1, |string| string.len())`
218
237
219
238
error: use Option::map_or instead of an if let/else
220
- --> $DIR/option_if_let_else.rs:217 :13
239
+ --> $DIR/option_if_let_else.rs:227 :13
221
240
|
222
241
LL | let _ = match Some(10) {
223
242
| _____________^
@@ -227,7 +246,7 @@ LL | | };
227
246
| |_____^ help: try: `Some(10).map_or(5, |a| a + 1)`
228
247
229
248
error: use Option::map_or instead of an if let/else
230
- --> $DIR/option_if_let_else.rs:223 :13
249
+ --> $DIR/option_if_let_else.rs:233 :13
231
250
|
232
251
LL | let _ = match res {
233
252
| _____________^
@@ -237,7 +256,7 @@ LL | | };
237
256
| |_____^ help: try: `res.map_or(1, |a| a + 1)`
238
257
239
258
error: use Option::map_or instead of an if let/else
240
- --> $DIR/option_if_let_else.rs:227 :13
259
+ --> $DIR/option_if_let_else.rs:237 :13
241
260
|
242
261
LL | let _ = match res {
243
262
| _____________^
@@ -247,10 +266,10 @@ LL | | };
247
266
| |_____^ help: try: `res.map_or(1, |a| a + 1)`
248
267
249
268
error: use Option::map_or instead of an if let/else
250
- --> $DIR/option_if_let_else.rs:231 :13
269
+ --> $DIR/option_if_let_else.rs:241 :13
251
270
|
252
271
LL | let _ = if let Ok(a) = res { a + 1 } else { 5 };
253
272
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `res.map_or(5, |a| a + 1)`
254
273
255
- error: aborting due to 20 previous errors
274
+ error: aborting due to 21 previous errors
256
275
0 commit comments