1
1
error: use Option::map_or instead of an if let/else
2
- --> $DIR/option_if_let_else.rs:7 :5
2
+ --> $DIR/option_if_let_else.rs:8 :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:25 :13
14
+ --> $DIR/option_if_let_else.rs:26 :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:26 :13
20
+ --> $DIR/option_if_let_else.rs:27 :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:27 :13
26
+ --> $DIR/option_if_let_else.rs:28 :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:33 :13
46
+ --> $DIR/option_if_let_else.rs:34 :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:34 :13
52
+ --> $DIR/option_if_let_else.rs:35 :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:40 :13
72
+ --> $DIR/option_if_let_else.rs:41 :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:49 :5
92
+ --> $DIR/option_if_let_else.rs:50 :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:62 :13
111
+ --> $DIR/option_if_let_else.rs:63 :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:71 :13
123
+ --> $DIR/option_if_let_else.rs:72 :13
124
124
|
125
125
LL | let _ = if let Some(x) = arg {
126
126
| _____________^
@@ -143,13 +143,13 @@ LL ~ }, |x| x * x * x * x);
143
143
|
144
144
145
145
error: use Option::map_or instead of an if let/else
146
- --> $DIR/option_if_let_else.rs:100 :13
146
+ --> $DIR/option_if_let_else.rs:101 :13
147
147
|
148
148
LL | let _ = if let Some(x) = optional { x + 2 } else { 5 };
149
149
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `optional.map_or(5, |x| x + 2)`
150
150
151
151
error: use Option::map_or instead of an if let/else
152
- --> $DIR/option_if_let_else.rs:109 :13
152
+ --> $DIR/option_if_let_else.rs:110 :13
153
153
|
154
154
LL | let _ = if let Some(x) = Some(0) {
155
155
| _____________^
@@ -171,13 +171,13 @@ LL ~ });
171
171
|
172
172
173
173
error: use Option::map_or_else instead of an if let/else
174
- --> $DIR/option_if_let_else.rs:137 :13
174
+ --> $DIR/option_if_let_else.rs:138 :13
175
175
|
176
176
LL | let _ = if let Some(x) = Some(0) { s.len() + x } else { s.len() };
177
177
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(0).map_or_else(|| s.len(), |x| s.len() + x)`
178
178
179
179
error: use Option::map_or instead of an if let/else
180
- --> $DIR/option_if_let_else.rs:141 :13
180
+ --> $DIR/option_if_let_else.rs:142 :13
181
181
|
182
182
LL | let _ = if let Some(x) = Some(0) {
183
183
| _____________^
0 commit comments