Skip to content

Commit b289a63

Browse files
committed
PR Followups
1 parent fecfc4a commit b289a63

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

tests/ui/while_let_some_result.fixed

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ fn base_2(x: i32) {
3131
}
3232
}
3333

34+
fn base_3(test_func: Box<Result<i32, &str>>) {
35+
while let Some(b) = test_func.ok() {}
36+
}
37+
3438
fn main() {
3539
let _ = base_1(1);
3640
let _ = base_2(2);

tests/ui/while_let_some_result.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ fn base_2(x: i32) {
3131
}
3232
}
3333

34+
fn base_3(test_func: Box<Result<i32, &str>>) {
35+
while let Some(b) = test_func.ok() {}
36+
}
37+
3438
fn main() {
3539
let _ = base_1(1);
3640
let _ = base_2(2);

tests/ui/while_let_some_result.stderr

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,13 @@ help: consider matching on `Ok(a)` and removing the call to `ok` instead
1010
LL | while let Ok(a) = wat.next() {
1111
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1212

13-
error: aborting due to previous error
13+
error: local variable doesn't need to be boxed here
14+
--> $DIR/while_let_some_result.rs:34:11
15+
|
16+
LL | fn base_3(test_func: Box<Result<i32, &str>>) {
17+
| ^^^^^^^^^
18+
|
19+
= note: `-D clippy::boxed-local` implied by `-D warnings`
20+
21+
error: aborting due to 2 previous errors
1422

0 commit comments

Comments
 (0)