1
1
error: use Option::map_or instead of an if let/else
2
- --> $DIR/option_if_let_else.rs:12 :5
2
+ --> $DIR/option_if_let_else.rs:13 :5
3
3
|
4
4
LL | / if let Some(x) = string {
5
5
LL | | (true, x)
@@ -11,19 +11,19 @@ LL | | }
11
11
= note: `-D clippy::option-if-let-else` implied by `-D warnings`
12
12
13
13
error: use Option::map_or instead of an if let/else
14
- --> $DIR/option_if_let_else.rs:30 :13
14
+ --> $DIR/option_if_let_else.rs:31 :13
15
15
|
16
16
LL | let _ = if let Some(s) = *string { s.len() } else { 0 };
17
17
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `string.map_or(0, |s| s.len())`
18
18
19
19
error: use Option::map_or instead of an if let/else
20
- --> $DIR/option_if_let_else.rs:31 :13
20
+ --> $DIR/option_if_let_else.rs:32 :13
21
21
|
22
22
LL | let _ = if let Some(s) = &num { s } else { &0 };
23
23
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.as_ref().map_or(&0, |s| s)`
24
24
25
25
error: use Option::map_or instead of an if let/else
26
- --> $DIR/option_if_let_else.rs:32 :13
26
+ --> $DIR/option_if_let_else.rs:33 :13
27
27
|
28
28
LL | let _ = if let Some(s) = &mut num {
29
29
| _____________^
@@ -43,13 +43,13 @@ LL ~ });
43
43
|
44
44
45
45
error: use Option::map_or instead of an if let/else
46
- --> $DIR/option_if_let_else.rs:38 :13
46
+ --> $DIR/option_if_let_else.rs:39 :13
47
47
|
48
48
LL | let _ = if let Some(ref s) = num { s } else { &0 };
49
49
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.as_ref().map_or(&0, |s| s)`
50
50
51
51
error: use Option::map_or instead of an if let/else
52
- --> $DIR/option_if_let_else.rs:39 :13
52
+ --> $DIR/option_if_let_else.rs:40 :13
53
53
|
54
54
LL | let _ = if let Some(mut s) = num {
55
55
| _____________^
@@ -69,7 +69,7 @@ LL ~ });
69
69
|
70
70
71
71
error: use Option::map_or instead of an if let/else
72
- --> $DIR/option_if_let_else.rs:45 :13
72
+ --> $DIR/option_if_let_else.rs:46 :13
73
73
|
74
74
LL | let _ = if let Some(ref mut s) = num {
75
75
| _____________^
@@ -89,7 +89,7 @@ LL ~ });
89
89
|
90
90
91
91
error: use Option::map_or instead of an if let/else
92
- --> $DIR/option_if_let_else.rs:54 :5
92
+ --> $DIR/option_if_let_else.rs:55 :5
93
93
|
94
94
LL | / if let Some(x) = arg {
95
95
LL | | let y = x * x;
@@ -108,7 +108,7 @@ LL + })
108
108
|
109
109
110
110
error: use Option::map_or_else instead of an if let/else
111
- --> $DIR/option_if_let_else.rs:67 :13
111
+ --> $DIR/option_if_let_else.rs:68 :13
112
112
|
113
113
LL | let _ = if let Some(x) = arg {
114
114
| _____________^
@@ -120,7 +120,7 @@ LL | | };
120
120
| |_____^ help: try: `arg.map_or_else(|| side_effect(), |x| x)`
121
121
122
122
error: use Option::map_or_else instead of an if let/else
123
- --> $DIR/option_if_let_else.rs:76 :13
123
+ --> $DIR/option_if_let_else.rs:77 :13
124
124
|
125
125
LL | let _ = if let Some(x) = arg {
126
126
| _____________^
@@ -143,7 +143,7 @@ LL ~ }, |x| x * x * x * x);
143
143
|
144
144
145
145
error: use Option::map_or_else instead of an if let/else
146
- --> $DIR/option_if_let_else.rs:109 :13
146
+ --> $DIR/option_if_let_else.rs:110 :13
147
147
|
148
148
LL | / if let Some(idx) = s.find('.') {
149
149
LL | | vec![s[..idx].to_string(), s[idx..].to_string()]
@@ -153,7 +153,7 @@ LL | | }
153
153
| |_____________^ help: try: `s.find('.').map_or_else(|| vec![s.to_string()], |idx| vec![s[..idx].to_string(), s[idx..].to_string()])`
154
154
155
155
error: use Option::map_or_else instead of an if let/else
156
- --> $DIR/option_if_let_else.rs:120 :5
156
+ --> $DIR/option_if_let_else.rs:121 :5
157
157
|
158
158
LL | / if let Ok(binding) = variable {
159
159
LL | | println!("Ok {binding}");
@@ -172,13 +172,13 @@ LL + })
172
172
|
173
173
174
174
error: use Option::map_or instead of an if let/else
175
- --> $DIR/option_if_let_else.rs:142 :13
175
+ --> $DIR/option_if_let_else.rs:143 :13
176
176
|
177
177
LL | let _ = if let Some(x) = optional { x + 2 } else { 5 };
178
178
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `optional.map_or(5, |x| x + 2)`
179
179
180
180
error: use Option::map_or instead of an if let/else
181
- --> $DIR/option_if_let_else.rs:152 :13
181
+ --> $DIR/option_if_let_else.rs:153 :13
182
182
|
183
183
LL | let _ = if let Some(x) = Some(0) {
184
184
| _____________^
@@ -200,13 +200,13 @@ LL ~ });
200
200
|
201
201
202
202
error: use Option::map_or instead of an if let/else
203
- --> $DIR/option_if_let_else.rs:180 :13
203
+ --> $DIR/option_if_let_else.rs:181 :13
204
204
|
205
205
LL | let _ = if let Some(x) = Some(0) { s.len() + x } else { s.len() };
206
206
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(0).map_or(s.len(), |x| s.len() + x)`
207
207
208
208
error: use Option::map_or instead of an if let/else
209
- --> $DIR/option_if_let_else.rs:184 :13
209
+ --> $DIR/option_if_let_else.rs:185 :13
210
210
|
211
211
LL | let _ = if let Some(x) = Some(0) {
212
212
| _____________^
@@ -226,7 +226,7 @@ LL ~ });
226
226
|
227
227
228
228
error: use Option::map_or instead of an if let/else
229
- --> $DIR/option_if_let_else.rs:223 :13
229
+ --> $DIR/option_if_let_else.rs:224 :13
230
230
|
231
231
LL | let _ = match s {
232
232
| _____________^
@@ -236,7 +236,7 @@ LL | | };
236
236
| |_____^ help: try: `s.map_or(1, |string| string.len())`
237
237
238
238
error: use Option::map_or instead of an if let/else
239
- --> $DIR/option_if_let_else.rs:227 :13
239
+ --> $DIR/option_if_let_else.rs:228 :13
240
240
|
241
241
LL | let _ = match Some(10) {
242
242
| _____________^
@@ -246,7 +246,7 @@ LL | | };
246
246
| |_____^ help: try: `Some(10).map_or(5, |a| a + 1)`
247
247
248
248
error: use Option::map_or instead of an if let/else
249
- --> $DIR/option_if_let_else.rs:233 :13
249
+ --> $DIR/option_if_let_else.rs:234 :13
250
250
|
251
251
LL | let _ = match res {
252
252
| _____________^
@@ -256,7 +256,7 @@ LL | | };
256
256
| |_____^ help: try: `res.map_or(1, |a| a + 1)`
257
257
258
258
error: use Option::map_or instead of an if let/else
259
- --> $DIR/option_if_let_else.rs:237 :13
259
+ --> $DIR/option_if_let_else.rs:238 :13
260
260
|
261
261
LL | let _ = match res {
262
262
| _____________^
@@ -266,13 +266,13 @@ LL | | };
266
266
| |_____^ help: try: `res.map_or(1, |a| a + 1)`
267
267
268
268
error: use Option::map_or instead of an if let/else
269
- --> $DIR/option_if_let_else.rs:241 :13
269
+ --> $DIR/option_if_let_else.rs:242 :13
270
270
|
271
271
LL | let _ = if let Ok(a) = res { a + 1 } else { 5 };
272
272
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `res.map_or(5, |a| a + 1)`
273
273
274
274
error: use Option::map_or instead of an if let/else
275
- --> $DIR/option_if_let_else.rs:258 :9
275
+ --> $DIR/option_if_let_else.rs:259 :9
276
276
|
277
277
LL | / match initial {
278
278
LL | | Some(value) => do_something(value),
@@ -281,7 +281,7 @@ LL | | }
281
281
| |_________^ help: try: `initial.as_ref().map_or({}, |value| do_something(value))`
282
282
283
283
error: use Option::map_or instead of an if let/else
284
- --> $DIR/option_if_let_else.rs:265 :9
284
+ --> $DIR/option_if_let_else.rs:266 :9
285
285
|
286
286
LL | / match initial {
287
287
LL | | Some(value) => do_something2(value),
0 commit comments