11error: this block may be rewritten with the `?` operator
2- --> tests/ui/question_mark.rs:7 :5
2+ --> tests/ui/question_mark.rs:9 :5
33 |
44LL | / if a.is_none() {
55LL | |
@@ -11,7 +11,7 @@ LL | | }
1111 = help: to override `-D warnings` add `#[allow(clippy::question_mark)]`
1212
1313error: this block may be rewritten with the `?` operator
14- --> tests/ui/question_mark.rs:53 :9
14+ --> tests/ui/question_mark.rs:55 :9
1515 |
1616LL | / if (self.opt).is_none() {
1717LL | |
@@ -20,7 +20,7 @@ LL | | }
2020 | |_________^ help: replace it with: `(self.opt)?;`
2121
2222error: this block may be rewritten with the `?` operator
23- --> tests/ui/question_mark.rs:58 :9
23+ --> tests/ui/question_mark.rs:60 :9
2424 |
2525LL | / if self.opt.is_none() {
2626LL | |
@@ -29,7 +29,7 @@ LL | | }
2929 | |_________^ help: replace it with: `self.opt?;`
3030
3131error: this block may be rewritten with the `?` operator
32- --> tests/ui/question_mark.rs:63 :17
32+ --> tests/ui/question_mark.rs:65 :17
3333 |
3434LL | let _ = if self.opt.is_none() {
3535 | _________________^
@@ -41,7 +41,7 @@ LL | | };
4141 | |_________^ help: replace it with: `Some(self.opt?)`
4242
4343error: this block may be rewritten with the `?` operator
44- --> tests/ui/question_mark.rs:70 :17
44+ --> tests/ui/question_mark.rs:72 :17
4545 |
4646LL | let _ = if let Some(x) = self.opt {
4747 | _________________^
@@ -53,7 +53,7 @@ LL | | };
5353 | |_________^ help: replace it with: `self.opt?`
5454
5555error: this block may be rewritten with the `?` operator
56- --> tests/ui/question_mark.rs:88 :9
56+ --> tests/ui/question_mark.rs:90 :9
5757 |
5858LL | / if self.opt.is_none() {
5959LL | |
@@ -62,7 +62,7 @@ LL | | }
6262 | |_________^ help: replace it with: `self.opt.as_ref()?;`
6363
6464error: this block may be rewritten with the `?` operator
65- --> tests/ui/question_mark.rs:97 :9
65+ --> tests/ui/question_mark.rs:99 :9
6666 |
6767LL | / if self.opt.is_none() {
6868LL | |
@@ -71,7 +71,7 @@ LL | | }
7171 | |_________^ help: replace it with: `self.opt.as_ref()?;`
7272
7373error: this block may be rewritten with the `?` operator
74- --> tests/ui/question_mark.rs:106 :9
74+ --> tests/ui/question_mark.rs:108 :9
7575 |
7676LL | / if self.opt.is_none() {
7777LL | |
@@ -80,7 +80,7 @@ LL | | }
8080 | |_________^ help: replace it with: `self.opt.as_ref()?;`
8181
8282error: this block may be rewritten with the `?` operator
83- --> tests/ui/question_mark.rs:114 :26
83+ --> tests/ui/question_mark.rs:116 :26
8484 |
8585LL | let v: &Vec<_> = if let Some(ref v) = self.opt {
8686 | __________________________^
@@ -92,7 +92,7 @@ LL | | };
9292 | |_________^ help: replace it with: `self.opt.as_ref()?`
9393
9494error: this block may be rewritten with the `?` operator
95- --> tests/ui/question_mark.rs:125 :17
95+ --> tests/ui/question_mark.rs:127 :17
9696 |
9797LL | let v = if let Some(v) = self.opt {
9898 | _________________^
@@ -104,7 +104,7 @@ LL | | };
104104 | |_________^ help: replace it with: `self.opt?`
105105
106106error: this block may be rewritten with the `?` operator
107- --> tests/ui/question_mark.rs:147 :5
107+ --> tests/ui/question_mark.rs:149 :5
108108 |
109109LL | / if f().is_none() {
110110LL | |
@@ -113,7 +113,7 @@ LL | | }
113113 | |_____^ help: replace it with: `f()?;`
114114
115115error: this `match` expression can be replaced with `?`
116- --> tests/ui/question_mark.rs:152 :16
116+ --> tests/ui/question_mark.rs:154 :16
117117 |
118118LL | let _val = match f() {
119119 | ________________^
@@ -124,7 +124,7 @@ LL | | };
124124 | |_____^ help: try instead: `f()?`
125125
126126error: this `match` expression can be replaced with `?`
127- --> tests/ui/question_mark.rs:163 :5
127+ --> tests/ui/question_mark.rs:165 :5
128128 |
129129LL | / match f() {
130130LL | |
@@ -134,7 +134,7 @@ LL | | };
134134 | |_____^ help: try instead: `f()?`
135135
136136error: this `match` expression can be replaced with `?`
137- --> tests/ui/question_mark.rs:169 :5
137+ --> tests/ui/question_mark.rs:171 :5
138138 |
139139LL | / match opt_none!() {
140140LL | |
@@ -144,13 +144,13 @@ LL | | };
144144 | |_____^ help: try instead: `opt_none!()?`
145145
146146error: this block may be rewritten with the `?` operator
147- --> tests/ui/question_mark.rs:196 :13
147+ --> tests/ui/question_mark.rs:198 :13
148148 |
149149LL | let _ = if let Ok(x) = x { x } else { return x };
150150 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x?`
151151
152152error: this block may be rewritten with the `?` operator
153- --> tests/ui/question_mark.rs:199 :5
153+ --> tests/ui/question_mark.rs:201 :5
154154 |
155155LL | / if x.is_err() {
156156LL | |
@@ -159,7 +159,7 @@ LL | | }
159159 | |_____^ help: replace it with: `x?;`
160160
161161error: this `match` expression can be replaced with `?`
162- --> tests/ui/question_mark.rs:204 :16
162+ --> tests/ui/question_mark.rs:206 :16
163163 |
164164LL | let _val = match func_returning_result() {
165165 | ________________^
@@ -170,7 +170,7 @@ LL | | };
170170 | |_____^ help: try instead: `func_returning_result()?`
171171
172172error: this `match` expression can be replaced with `?`
173- --> tests/ui/question_mark.rs:210 :5
173+ --> tests/ui/question_mark.rs:212 :5
174174 |
175175LL | / match func_returning_result() {
176176LL | |
@@ -180,7 +180,7 @@ LL | | };
180180 | |_____^ help: try instead: `func_returning_result()?`
181181
182182error: this block may be rewritten with the `?` operator
183- --> tests/ui/question_mark.rs:302 :5
183+ --> tests/ui/question_mark.rs:304 :5
184184 |
185185LL | / if let Err(err) = func_returning_result() {
186186LL | |
@@ -189,7 +189,7 @@ LL | | }
189189 | |_____^ help: replace it with: `func_returning_result()?;`
190190
191191error: this block may be rewritten with the `?` operator
192- --> tests/ui/question_mark.rs:310 :5
192+ --> tests/ui/question_mark.rs:312 :5
193193 |
194194LL | / if let Err(err) = func_returning_result() {
195195LL | |
@@ -198,7 +198,7 @@ LL | | }
198198 | |_____^ help: replace it with: `func_returning_result()?;`
199199
200200error: this block may be rewritten with the `?` operator
201- --> tests/ui/question_mark.rs:388 :13
201+ --> tests/ui/question_mark.rs:390 :13
202202 |
203203LL | / if a.is_none() {
204204LL | |
@@ -208,55 +208,55 @@ LL | | }
208208 | |_____________^ help: replace it with: `a?;`
209209
210210error: this `let...else` may be rewritten with the `?` operator
211- --> tests/ui/question_mark.rs:449 :5
211+ --> tests/ui/question_mark.rs:451 :5
212212 |
213213LL | / let Some(v) = bar.foo.owned.clone() else {
214214LL | | return None;
215215LL | | };
216216 | |______^ help: replace it with: `let v = bar.foo.owned.clone()?;`
217217
218218error: this `let...else` may be rewritten with the `?` operator
219- --> tests/ui/question_mark.rs:464 :5
219+ --> tests/ui/question_mark.rs:466 :5
220220 |
221221LL | / let Some(ref x) = foo.opt_x else {
222222LL | | return None;
223223LL | | };
224224 | |______^ help: replace it with: `let x = foo.opt_x.as_ref()?;`
225225
226226error: this `let...else` may be rewritten with the `?` operator
227- --> tests/ui/question_mark.rs:474 :5
227+ --> tests/ui/question_mark.rs:476 :5
228228 |
229229LL | / let Some(ref mut x) = foo.opt_x else {
230230LL | | return None;
231231LL | | };
232232 | |______^ help: replace it with: `let x = foo.opt_x.as_mut()?;`
233233
234234error: this `let...else` may be rewritten with the `?` operator
235- --> tests/ui/question_mark.rs:485 :5
235+ --> tests/ui/question_mark.rs:487 :5
236236 |
237237LL | / let Some(ref x @ ref y) = foo.opt_x else {
238238LL | | return None;
239239LL | | };
240240 | |______^ help: replace it with: `let x @ y = foo.opt_x.as_ref()?;`
241241
242242error: this `let...else` may be rewritten with the `?` operator
243- --> tests/ui/question_mark.rs:489 :5
243+ --> tests/ui/question_mark.rs:491 :5
244244 |
245245LL | / let Some(ref x @ WrapperStructWithString(_)) = bar else {
246246LL | | return None;
247247LL | | };
248248 | |______^ help: replace it with: `let x @ &WrapperStructWithString(_) = bar.as_ref()?;`
249249
250250error: this `let...else` may be rewritten with the `?` operator
251- --> tests/ui/question_mark.rs:493 :5
251+ --> tests/ui/question_mark.rs:495 :5
252252 |
253253LL | / let Some(ref mut x @ WrapperStructWithString(_)) = bar else {
254254LL | | return None;
255255LL | | };
256256 | |______^ help: replace it with: `let x @ &mut WrapperStructWithString(_) = bar.as_mut()?;`
257257
258258error: this block may be rewritten with the `?` operator
259- --> tests/ui/question_mark.rs:515 :5
259+ --> tests/ui/question_mark.rs:517 :5
260260 |
261261LL | / if arg.is_none() {
262262LL | |
@@ -265,7 +265,7 @@ LL | | }
265265 | |_____^ help: replace it with: `arg?;`
266266
267267error: this `match` expression can be replaced with `?`
268- --> tests/ui/question_mark.rs:519 :15
268+ --> tests/ui/question_mark.rs:521 :15
269269 |
270270LL | let val = match arg {
271271 | _______________^
@@ -275,5 +275,13 @@ LL | | None => return None,
275275LL | | };
276276 | |_____^ help: try instead: `arg?`
277277
278- error: aborting due to 29 previous errors
278+ error: this `let...else` may be rewritten with the `?` operator
279+ --> tests/ui/question_mark.rs:531:5
280+ |
281+ LL | / let Some(a) = *a else {
282+ LL | | return None;
283+ LL | | };
284+ | |______^ help: replace it with: `let a = (*a)?;`
285+
286+ error: aborting due to 30 previous errors
279287
0 commit comments