@@ -158,28 +158,32 @@ error: use Option::map_or_else instead of an if let/else
158158 |
159159LL | / if let Ok(binding) = variable {
160160LL | | println!("Ok {binding}");
161+ LL | | true
161162LL | | } else {
162163LL | | println!("Err");
164+ LL | | false
163165LL | | }
164166 | |_____^
165167 |
166168help: try
167169 |
168170LL ~ variable.map_or_else(|_| {
169171LL + println!("Err");
172+ LL + false
170173LL + }, |binding| {
171174LL + println!("Ok {binding}");
175+ LL + true
172176LL + })
173177 |
174178
175179error: use Option::map_or instead of an if let/else
176- --> $DIR/option_if_let_else.rs:141 :13
180+ --> $DIR/option_if_let_else.rs:143 :13
177181 |
178182LL | let _ = if let Some(x) = optional { x + 2 } else { 5 };
179183 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `optional.map_or(5, |x| x + 2)`
180184
181185error: use Option::map_or instead of an if let/else
182- --> $DIR/option_if_let_else.rs:151 :13
186+ --> $DIR/option_if_let_else.rs:153 :13
183187 |
184188LL | let _ = if let Some(x) = Some(0) {
185189 | _____________^
@@ -201,13 +205,13 @@ LL ~ });
201205 |
202206
203207error: use Option::map_or instead of an if let/else
204- --> $DIR/option_if_let_else.rs:179 :13
208+ --> $DIR/option_if_let_else.rs:181 :13
205209 |
206210LL | let _ = if let Some(x) = Some(0) { s.len() + x } else { s.len() };
207211 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(0).map_or(s.len(), |x| s.len() + x)`
208212
209213error: use Option::map_or instead of an if let/else
210- --> $DIR/option_if_let_else.rs:183 :13
214+ --> $DIR/option_if_let_else.rs:185 :13
211215 |
212216LL | let _ = if let Some(x) = Some(0) {
213217 | _____________^
@@ -227,7 +231,7 @@ LL ~ });
227231 |
228232
229233error: use Option::map_or instead of an if let/else
230- --> $DIR/option_if_let_else.rs:222 :13
234+ --> $DIR/option_if_let_else.rs:224 :13
231235 |
232236LL | let _ = match s {
233237 | _____________^
@@ -237,7 +241,7 @@ LL | | };
237241 | |_____^ help: try: `s.map_or(1, |string| string.len())`
238242
239243error: use Option::map_or instead of an if let/else
240- --> $DIR/option_if_let_else.rs:226 :13
244+ --> $DIR/option_if_let_else.rs:228 :13
241245 |
242246LL | let _ = match Some(10) {
243247 | _____________^
@@ -247,7 +251,7 @@ LL | | };
247251 | |_____^ help: try: `Some(10).map_or(5, |a| a + 1)`
248252
249253error: use Option::map_or instead of an if let/else
250- --> $DIR/option_if_let_else.rs:232 :13
254+ --> $DIR/option_if_let_else.rs:234 :13
251255 |
252256LL | let _ = match res {
253257 | _____________^
@@ -257,7 +261,7 @@ LL | | };
257261 | |_____^ help: try: `res.map_or(1, |a| a + 1)`
258262
259263error: use Option::map_or instead of an if let/else
260- --> $DIR/option_if_let_else.rs:236 :13
264+ --> $DIR/option_if_let_else.rs:238 :13
261265 |
262266LL | let _ = match res {
263267 | _____________^
@@ -267,31 +271,33 @@ LL | | };
267271 | |_____^ help: try: `res.map_or(1, |a| a + 1)`
268272
269273error: use Option::map_or instead of an if let/else
270- --> $DIR/option_if_let_else.rs:240 :13
274+ --> $DIR/option_if_let_else.rs:242 :13
271275 |
272276LL | let _ = if let Ok(a) = res { a + 1 } else { 5 };
273277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `res.map_or(5, |a| a + 1)`
274278
275279error: use Option::map_or instead of an if let/else
276- --> $DIR/option_if_let_else.rs:257:9
280+ --> $DIR/option_if_let_else.rs:259:17
277281 |
278- LL | / match initial {
282+ LL | let _ = match initial {
283+ | _________________^
279284LL | | Some(value) => do_something(value),
280- LL | | None => {} ,
281- LL | | }
282- | |_________^ help: try: `initial.as_ref().map_or({} , |value| do_something(value))`
285+ LL | | None => 42 ,
286+ LL | | };
287+ | |_________^ help: try: `initial.as_ref().map_or(42 , |value| do_something(value))`
283288
284289error: use Option::map_or instead of an if let/else
285- --> $DIR/option_if_let_else.rs:264:9
290+ --> $DIR/option_if_let_else.rs:266:17
286291 |
287- LL | / match initial {
292+ LL | let _ = match initial {
293+ | _________________^
288294LL | | Some(value) => do_something2(value),
289- LL | | None => {} ,
290- LL | | }
291- | |_________^ help: try: `initial.as_mut().map_or({} , |value| do_something2(value))`
295+ LL | | None => 42 ,
296+ LL | | };
297+ | |_________^ help: try: `initial.as_mut().map_or(42 , |value| do_something2(value))`
292298
293299error: use Option::map_or_else instead of an if let/else
294- --> $DIR/option_if_let_else.rs:283 :24
300+ --> $DIR/option_if_let_else.rs:289 :24
295301 |
296302LL | let mut _hashmap = if let Some(hm) = &opt {
297303 | ________________________^
@@ -302,7 +308,7 @@ LL | | };
302308 | |_____^ help: try: `opt.as_ref().map_or_else(HashMap::new, |hm| hm.clone())`
303309
304310error: use Option::map_or_else instead of an if let/else
305- --> $DIR/option_if_let_else.rs:289 :19
311+ --> $DIR/option_if_let_else.rs:295 :19
306312 |
307313LL | let mut _hm = if let Some(hm) = &opt { hm.clone() } else { new_map!() };
308314 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `opt.as_ref().map_or_else(|| new_map!(), |hm| hm.clone())`
0 commit comments