@@ -152,14 +152,33 @@ LL | | vec![s.to_string()]
152152LL | | }
153153 | |_____________^ help: try: `s.find('.').map_or_else(|| vec![s.to_string()], |idx| vec![s[..idx].to_string(), s[idx..].to_string()])`
154154
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+
155174error: 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
157176 |
158177LL | let _ = if let Some(x) = optional { x + 2 } else { 5 };
159178 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `optional.map_or(5, |x| x + 2)`
160179
161180error: 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
163182 |
164183LL | let _ = if let Some(x) = Some(0) {
165184 | _____________^
@@ -181,13 +200,13 @@ LL ~ });
181200 |
182201
183202error: 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
185204 |
186205LL | let _ = if let Some(x) = Some(0) { s.len() + x } else { s.len() };
187206 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(0).map_or(s.len(), |x| s.len() + x)`
188207
189208error: 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
191210 |
192211LL | let _ = if let Some(x) = Some(0) {
193212 | _____________^
@@ -207,7 +226,7 @@ LL ~ });
207226 |
208227
209228error: 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
211230 |
212231LL | let _ = match s {
213232 | _____________^
@@ -217,7 +236,7 @@ LL | | };
217236 | |_____^ help: try: `s.map_or(1, |string| string.len())`
218237
219238error: 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
221240 |
222241LL | let _ = match Some(10) {
223242 | _____________^
@@ -227,7 +246,7 @@ LL | | };
227246 | |_____^ help: try: `Some(10).map_or(5, |a| a + 1)`
228247
229248error: 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
231250 |
232251LL | let _ = match res {
233252 | _____________^
@@ -237,7 +256,7 @@ LL | | };
237256 | |_____^ help: try: `res.map_or(1, |a| a + 1)`
238257
239258error: 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
241260 |
242261LL | let _ = match res {
243262 | _____________^
@@ -247,10 +266,10 @@ LL | | };
247266 | |_____^ help: try: `res.map_or(1, |a| a + 1)`
248267
249268error: 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
251270 |
252271LL | let _ = if let Ok(a) = res { a + 1 } else { 5 };
253272 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `res.map_or(5, |a| a + 1)`
254273
255- error: aborting due to 20 previous errors
274+ error: aborting due to 21 previous errors
256275
0 commit comments