@@ -188,14 +188,32 @@ LL +         true
188188LL +     })
189189   |
190190
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+ 
191209error: 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
193211   |
194212LL |     let _ = if let Some(x) = optional { x + 2 } else { 5 };
195213   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `optional.map_or(5, |x| x + 2)`
196214
197215error: 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
199217   |
200218LL |       let _ = if let Some(x) = Some(0) {
201219   |  _____________^
@@ -217,13 +235,13 @@ LL ~         });
217235   |
218236
219237error: 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
221239   |
222240LL |     let _ = if let Some(x) = Some(0) { s.len() + x } else { s.len() };
223241   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(0).map_or(s.len(), |x| s.len() + x)`
224242
225243error: 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
227245   |
228246LL |       let _ = if let Some(x) = Some(0) {
229247   |  _____________^
@@ -245,7 +263,7 @@ LL ~     });
245263   |
246264
247265error: 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
249267   |
250268LL |       let _ = match s {
251269   |  _____________^
@@ -256,7 +274,7 @@ LL | |     };
256274   | |_____^ help: try: `s.map_or(1, |string| string.len())`
257275
258276error: 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
260278   |
261279LL |       let _ = match Some(10) {
262280   |  _____________^
@@ -267,7 +285,7 @@ LL | |     };
267285   | |_____^ help: try: `Some(10).map_or(5, |a| a + 1)`
268286
269287error: 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
271289   |
272290LL |       let _ = match res {
273291   |  _____________^
@@ -278,7 +296,7 @@ LL | |     };
278296   | |_____^ help: try: `res.map_or(1, |a| a + 1)`
279297
280298error: 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
282300   |
283301LL |       let _ = match res {
284302   |  _____________^
@@ -289,13 +307,13 @@ LL | |     };
289307   | |_____^ help: try: `res.map_or(1, |a| a + 1)`
290308
291309error: 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
293311   |
294312LL |     let _ = if let Ok(a) = res { a + 1 } else { 5 };
295313   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `res.map_or(5, |a| a + 1)`
296314
297315error: 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
299317   |
300318LL |           let _ = match initial {
301319   |  _________________^
@@ -306,7 +324,7 @@ LL | |         };
306324   | |_________^ help: try: `initial.as_ref().map_or(42, |value| do_something(value))`
307325
308326error: 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
310328   |
311329LL |           let _ = match initial {
312330   |  _________________^
@@ -317,7 +335,7 @@ LL | |         };
317335   | |_________^ help: try: `initial.as_mut().map_or(42, |value| do_something2(value))`
318336
319337error: 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
321339   |
322340LL |       let mut _hashmap = if let Some(hm) = &opt {
323341   |  ________________________^
@@ -329,19 +347,19 @@ LL | |     };
329347   | |_____^ help: try: `opt.as_ref().map_or_else(HashMap::new, |hm| hm.clone())`
330348
331349error: 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
333351   |
334352LL |     let mut _hm = if let Some(hm) = &opt { hm.clone() } else { new_map!() };
335353   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `opt.as_ref().map_or_else(|| new_map!(), |hm| hm.clone())`
336354
337355error: use Option::map_or instead of an if let/else
338-   --> tests/ui/option_if_let_else.rs:372 :22
356+   --> tests/ui/option_if_let_else.rs:388 :22
339357   |
340358LL |     let _ = unsafe { if let Some(o) = *opt_raw_ptr { o } else { 1 } };
341359   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(*opt_raw_ptr).map_or(1, |o| o)`
342360
343361error: use Option::map_or_else instead of an if let/else
344-   --> tests/ui/option_if_let_else.rs:378 :13
362+   --> tests/ui/option_if_let_else.rs:394 :13
345363   |
346364LL |       let _ = match res {
347365   |  _____________^
@@ -351,5 +369,5 @@ LL | |         Err(_) => String::new(),
351369LL | |     };
352370   | |_____^ help: try: `res.map_or_else(|_| String::new(), |s| s.clone())`
353371
354- error: aborting due to 27  previous errors
372+ error: aborting due to 29  previous errors
355373
0 commit comments