1
1
error: use Option::map_or instead of an if let/else
2
- --> tests/ui/option_if_let_else.rs:13 :5
2
+ --> tests/ui/option_if_let_else.rs:14 :5
3
3
|
4
4
LL | / if let Some(x) = string {
5
5
LL | |
@@ -13,19 +13,19 @@ LL | | }
13
13
= help: to override `-D warnings` add `#[allow(clippy::option_if_let_else)]`
14
14
15
15
error: use Option::map_or instead of an if let/else
16
- --> tests/ui/option_if_let_else.rs:32 :13
16
+ --> tests/ui/option_if_let_else.rs:33 :13
17
17
|
18
18
LL | let _ = if let Some(s) = *string { s.len() } else { 0 };
19
19
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `string.map_or(0, |s| s.len())`
20
20
21
21
error: use Option::map_or instead of an if let/else
22
- --> tests/ui/option_if_let_else.rs:34 :13
22
+ --> tests/ui/option_if_let_else.rs:35 :13
23
23
|
24
24
LL | let _ = if let Some(s) = &num { s } else { &0 };
25
25
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.as_ref().map_or(&0, |s| s)`
26
26
27
27
error: use Option::map_or instead of an if let/else
28
- --> tests/ui/option_if_let_else.rs:36 :13
28
+ --> tests/ui/option_if_let_else.rs:37 :13
29
29
|
30
30
LL | let _ = if let Some(s) = &mut num {
31
31
| _____________^
@@ -47,13 +47,13 @@ LL ~ });
47
47
|
48
48
49
49
error: use Option::map_or instead of an if let/else
50
- --> tests/ui/option_if_let_else.rs:43 :13
50
+ --> tests/ui/option_if_let_else.rs:44 :13
51
51
|
52
52
LL | let _ = if let Some(ref s) = num { s } else { &0 };
53
53
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.as_ref().map_or(&0, |s| s)`
54
54
55
55
error: use Option::map_or instead of an if let/else
56
- --> tests/ui/option_if_let_else.rs:45 :13
56
+ --> tests/ui/option_if_let_else.rs:46 :13
57
57
|
58
58
LL | let _ = if let Some(mut s) = num {
59
59
| _____________^
@@ -75,7 +75,7 @@ LL ~ });
75
75
|
76
76
77
77
error: use Option::map_or instead of an if let/else
78
- --> tests/ui/option_if_let_else.rs:52 :13
78
+ --> tests/ui/option_if_let_else.rs:53 :13
79
79
|
80
80
LL | let _ = if let Some(ref mut s) = num {
81
81
| _____________^
@@ -97,7 +97,7 @@ LL ~ });
97
97
|
98
98
99
99
error: use Option::map_or instead of an if let/else
100
- --> tests/ui/option_if_let_else.rs:62 :5
100
+ --> tests/ui/option_if_let_else.rs:63 :5
101
101
|
102
102
LL | / if let Some(x) = arg {
103
103
LL | |
@@ -118,7 +118,7 @@ LL + })
118
118
|
119
119
120
120
error: use Option::map_or_else instead of an if let/else
121
- --> tests/ui/option_if_let_else.rs:76 :13
121
+ --> tests/ui/option_if_let_else.rs:77 :13
122
122
|
123
123
LL | let _ = if let Some(x) = arg {
124
124
| _____________^
@@ -131,7 +131,7 @@ LL | | };
131
131
| |_____^ help: try: `arg.map_or_else(side_effect, |x| x)`
132
132
133
133
error: use Option::map_or_else instead of an if let/else
134
- --> tests/ui/option_if_let_else.rs:86 :13
134
+ --> tests/ui/option_if_let_else.rs:87 :13
135
135
|
136
136
LL | let _ = if let Some(x) = arg {
137
137
| _____________^
@@ -154,7 +154,7 @@ LL ~ }, |x| x * x * x * x);
154
154
|
155
155
156
156
error: use Option::map_or_else instead of an if let/else
157
- --> tests/ui/option_if_let_else.rs:120 :13
157
+ --> tests/ui/option_if_let_else.rs:121 :13
158
158
|
159
159
LL | / if let Some(idx) = s.find('.') {
160
160
LL | |
@@ -165,7 +165,7 @@ LL | | }
165
165
| |_____________^ help: try: `s.find('.').map_or_else(|| vec![s.to_string()], |idx| vec![s[..idx].to_string(), s[idx..].to_string()])`
166
166
167
167
error: use Option::map_or_else instead of an if let/else
168
- --> tests/ui/option_if_let_else.rs:132 :5
168
+ --> tests/ui/option_if_let_else.rs:133 :5
169
169
|
170
170
LL | / if let Ok(binding) = variable {
171
171
LL | |
@@ -189,13 +189,13 @@ LL + })
189
189
|
190
190
191
191
error: use Option::map_or instead of an if let/else
192
- --> tests/ui/option_if_let_else.rs:157 :13
192
+ --> tests/ui/option_if_let_else.rs:158 :13
193
193
|
194
194
LL | let _ = if let Some(x) = optional { x + 2 } else { 5 };
195
195
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `optional.map_or(5, |x| x + 2)`
196
196
197
197
error: use Option::map_or instead of an if let/else
198
- --> tests/ui/option_if_let_else.rs:168 :13
198
+ --> tests/ui/option_if_let_else.rs:169 :13
199
199
|
200
200
LL | let _ = if let Some(x) = Some(0) {
201
201
| _____________^
@@ -217,13 +217,13 @@ LL ~ });
217
217
|
218
218
219
219
error: use Option::map_or instead of an if let/else
220
- --> tests/ui/option_if_let_else.rs:197 :13
220
+ --> tests/ui/option_if_let_else.rs:198 :13
221
221
|
222
222
LL | let _ = if let Some(x) = Some(0) { s.len() + x } else { s.len() };
223
223
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(0).map_or(s.len(), |x| s.len() + x)`
224
224
225
225
error: use Option::map_or instead of an if let/else
226
- --> tests/ui/option_if_let_else.rs:202 :13
226
+ --> tests/ui/option_if_let_else.rs:203 :13
227
227
|
228
228
LL | let _ = if let Some(x) = Some(0) {
229
229
| _____________^
@@ -245,7 +245,7 @@ LL ~ });
245
245
|
246
246
247
247
error: use Option::map_or instead of an if let/else
248
- --> tests/ui/option_if_let_else.rs:242 :13
248
+ --> tests/ui/option_if_let_else.rs:243 :13
249
249
|
250
250
LL | let _ = match s {
251
251
| _____________^
@@ -256,7 +256,7 @@ LL | | };
256
256
| |_____^ help: try: `s.map_or(1, |string| string.len())`
257
257
258
258
error: use Option::map_or instead of an if let/else
259
- --> tests/ui/option_if_let_else.rs:247 :13
259
+ --> tests/ui/option_if_let_else.rs:248 :13
260
260
|
261
261
LL | let _ = match Some(10) {
262
262
| _____________^
@@ -267,7 +267,7 @@ LL | | };
267
267
| |_____^ help: try: `Some(10).map_or(5, |a| a + 1)`
268
268
269
269
error: use Option::map_or instead of an if let/else
270
- --> tests/ui/option_if_let_else.rs:254 :13
270
+ --> tests/ui/option_if_let_else.rs:255 :13
271
271
|
272
272
LL | let _ = match res {
273
273
| _____________^
@@ -278,7 +278,7 @@ LL | | };
278
278
| |_____^ help: try: `res.map_or(1, |a| a + 1)`
279
279
280
280
error: use Option::map_or instead of an if let/else
281
- --> tests/ui/option_if_let_else.rs:259 :13
281
+ --> tests/ui/option_if_let_else.rs:260 :13
282
282
|
283
283
LL | let _ = match res {
284
284
| _____________^
@@ -289,13 +289,13 @@ LL | | };
289
289
| |_____^ help: try: `res.map_or(1, |a| a + 1)`
290
290
291
291
error: use Option::map_or instead of an if let/else
292
- --> tests/ui/option_if_let_else.rs:264 :13
292
+ --> tests/ui/option_if_let_else.rs:265 :13
293
293
|
294
294
LL | let _ = if let Ok(a) = res { a + 1 } else { 5 };
295
295
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `res.map_or(5, |a| a + 1)`
296
296
297
297
error: use Option::map_or instead of an if let/else
298
- --> tests/ui/option_if_let_else.rs:282 :17
298
+ --> tests/ui/option_if_let_else.rs:283 :17
299
299
|
300
300
LL | let _ = match initial {
301
301
| _________________^
@@ -306,7 +306,7 @@ LL | | };
306
306
| |_________^ help: try: `initial.as_ref().map_or(42, |value| do_something(value))`
307
307
308
308
error: use Option::map_or instead of an if let/else
309
- --> tests/ui/option_if_let_else.rs:290 :17
309
+ --> tests/ui/option_if_let_else.rs:291 :17
310
310
|
311
311
LL | let _ = match initial {
312
312
| _________________^
@@ -317,7 +317,7 @@ LL | | };
317
317
| |_________^ help: try: `initial.as_mut().map_or(42, |value| do_something2(value))`
318
318
319
319
error: use Option::map_or_else instead of an if let/else
320
- --> tests/ui/option_if_let_else.rs:314 :24
320
+ --> tests/ui/option_if_let_else.rs:315 :24
321
321
|
322
322
LL | let mut _hashmap = if let Some(hm) = &opt {
323
323
| ________________________^
@@ -329,7 +329,7 @@ LL | | };
329
329
| |_____^ help: try: `opt.as_ref().map_or_else(HashMap::new, |hm| hm.clone())`
330
330
331
331
error: use Option::map_or_else instead of an if let/else
332
- --> tests/ui/option_if_let_else.rs:321 :19
332
+ --> tests/ui/option_if_let_else.rs:322 :19
333
333
|
334
334
LL | let mut _hm = if let Some(hm) = &opt { hm.clone() } else { new_map!() };
335
335
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `opt.as_ref().map_or_else(|| new_map!(), |hm| hm.clone())`
0 commit comments