@@ -188,14 +188,32 @@ LL + true
188
188
LL + })
189
189
|
190
190
191
+ error: use Option::map_or_else instead of an if let/else
192
+ --> tests/ui/option_if_let_else.rs:157:5
193
+ |
194
+ LL | / match r {
195
+ LL | |
196
+ LL | | Ok(s) => s.to_owned(),
197
+ LL | | Err(_) => Vec::new(),
198
+ LL | | }
199
+ | |_____^ help: try: `r.map_or_else(|_| Vec::new(), |s| s.to_owned())`
200
+
201
+ error: use Option::map_or_else instead of an if let/else
202
+ --> tests/ui/option_if_let_else.rs:166:5
203
+ |
204
+ LL | / if let Ok(s) = r { s.to_owned() }
205
+ LL | |
206
+ LL | | else { Vec::new() }
207
+ | |_______________________^ help: try: `r.map_or_else(|_| Vec::new(), |s| s.to_owned())`
208
+
191
209
error: use Option::map_or instead of an if let/else
192
- --> tests/ui/option_if_let_else.rs:157 :13
210
+ --> tests/ui/option_if_let_else.rs:173 :13
193
211
|
194
212
LL | let _ = if let Some(x) = optional { x + 2 } else { 5 };
195
213
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `optional.map_or(5, |x| x + 2)`
196
214
197
215
error: use Option::map_or instead of an if let/else
198
- --> tests/ui/option_if_let_else.rs:168 :13
216
+ --> tests/ui/option_if_let_else.rs:184 :13
199
217
|
200
218
LL | let _ = if let Some(x) = Some(0) {
201
219
| _____________^
@@ -217,13 +235,13 @@ LL ~ });
217
235
|
218
236
219
237
error: use Option::map_or instead of an if let/else
220
- --> tests/ui/option_if_let_else.rs:197 :13
238
+ --> tests/ui/option_if_let_else.rs:213 :13
221
239
|
222
240
LL | let _ = if let Some(x) = Some(0) { s.len() + x } else { s.len() };
223
241
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(0).map_or(s.len(), |x| s.len() + x)`
224
242
225
243
error: use Option::map_or instead of an if let/else
226
- --> tests/ui/option_if_let_else.rs:202 :13
244
+ --> tests/ui/option_if_let_else.rs:218 :13
227
245
|
228
246
LL | let _ = if let Some(x) = Some(0) {
229
247
| _____________^
@@ -245,7 +263,7 @@ LL ~ });
245
263
|
246
264
247
265
error: use Option::map_or instead of an if let/else
248
- --> tests/ui/option_if_let_else.rs:242 :13
266
+ --> tests/ui/option_if_let_else.rs:258 :13
249
267
|
250
268
LL | let _ = match s {
251
269
| _____________^
@@ -256,7 +274,7 @@ LL | | };
256
274
| |_____^ help: try: `s.map_or(1, |string| string.len())`
257
275
258
276
error: use Option::map_or instead of an if let/else
259
- --> tests/ui/option_if_let_else.rs:247 :13
277
+ --> tests/ui/option_if_let_else.rs:263 :13
260
278
|
261
279
LL | let _ = match Some(10) {
262
280
| _____________^
@@ -267,7 +285,7 @@ LL | | };
267
285
| |_____^ help: try: `Some(10).map_or(5, |a| a + 1)`
268
286
269
287
error: use Option::map_or instead of an if let/else
270
- --> tests/ui/option_if_let_else.rs:254 :13
288
+ --> tests/ui/option_if_let_else.rs:270 :13
271
289
|
272
290
LL | let _ = match res {
273
291
| _____________^
@@ -278,7 +296,7 @@ LL | | };
278
296
| |_____^ help: try: `res.map_or(1, |a| a + 1)`
279
297
280
298
error: use Option::map_or instead of an if let/else
281
- --> tests/ui/option_if_let_else.rs:259 :13
299
+ --> tests/ui/option_if_let_else.rs:275 :13
282
300
|
283
301
LL | let _ = match res {
284
302
| _____________^
@@ -289,13 +307,13 @@ LL | | };
289
307
| |_____^ help: try: `res.map_or(1, |a| a + 1)`
290
308
291
309
error: use Option::map_or instead of an if let/else
292
- --> tests/ui/option_if_let_else.rs:264 :13
310
+ --> tests/ui/option_if_let_else.rs:280 :13
293
311
|
294
312
LL | let _ = if let Ok(a) = res { a + 1 } else { 5 };
295
313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `res.map_or(5, |a| a + 1)`
296
314
297
315
error: use Option::map_or instead of an if let/else
298
- --> tests/ui/option_if_let_else.rs:282 :17
316
+ --> tests/ui/option_if_let_else.rs:298 :17
299
317
|
300
318
LL | let _ = match initial {
301
319
| _________________^
@@ -306,7 +324,7 @@ LL | | };
306
324
| |_________^ help: try: `initial.as_ref().map_or(42, |value| do_something(value))`
307
325
308
326
error: use Option::map_or instead of an if let/else
309
- --> tests/ui/option_if_let_else.rs:290 :17
327
+ --> tests/ui/option_if_let_else.rs:306 :17
310
328
|
311
329
LL | let _ = match initial {
312
330
| _________________^
@@ -317,7 +335,7 @@ LL | | };
317
335
| |_________^ help: try: `initial.as_mut().map_or(42, |value| do_something2(value))`
318
336
319
337
error: use Option::map_or_else instead of an if let/else
320
- --> tests/ui/option_if_let_else.rs:314 :24
338
+ --> tests/ui/option_if_let_else.rs:330 :24
321
339
|
322
340
LL | let mut _hashmap = if let Some(hm) = &opt {
323
341
| ________________________^
@@ -329,10 +347,10 @@ LL | | };
329
347
| |_____^ help: try: `opt.as_ref().map_or_else(HashMap::new, |hm| hm.clone())`
330
348
331
349
error: use Option::map_or_else instead of an if let/else
332
- --> tests/ui/option_if_let_else.rs:321 :19
350
+ --> tests/ui/option_if_let_else.rs:337 :19
333
351
|
334
352
LL | let mut _hm = if let Some(hm) = &opt { hm.clone() } else { new_map!() };
335
353
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `opt.as_ref().map_or_else(|| new_map!(), |hm| hm.clone())`
336
354
337
- error: aborting due to 25 previous errors
355
+ error: aborting due to 27 previous errors
338
356
0 commit comments