Skip to content

Commit 475dbeb

Browse files
committed
Fixing test case syntax
1 parent 3c48192 commit 475dbeb

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

tests/ui/while_let_some_result.fixed

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// run-rustfix
22

33
#![warn(clippy::while_let_some_result)]
4+
#![allow(clippy::boxed_local)]
45

56
struct Wat {
67
counter: i32,
@@ -31,8 +32,8 @@ fn base_2(x: i32) {
3132
}
3233
}
3334

34-
fn base_3(test_func: Box<Result<i32, &str>>) {
35-
while let Some(b) = test_func.ok() {}
35+
fn _base_3(test_func: Box<Result<i32, &str>>) {
36+
while let Some(_b) = test_func.ok() {}
3637
}
3738

3839
fn main() {

tests/ui/while_let_some_result.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// run-rustfix
22

33
#![warn(clippy::while_let_some_result)]
4+
#![allow(clippy::boxed_local)]
45

56
struct Wat {
67
counter: i32,
@@ -31,8 +32,8 @@ fn base_2(x: i32) {
3132
}
3233
}
3334

34-
fn base_3(test_func: Box<Result<i32, &str>>) {
35-
while let Some(b) = test_func.ok() {}
35+
fn _base_3(test_func: Box<Result<i32, &str>>) {
36+
while let Some(_b) = test_func.ok() {}
3637
}
3738

3839
fn main() {

tests/ui/while_let_some_result.stderr

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: matching on `Some` with `ok()` is redundant
2-
--> $DIR/while_let_some_result.rs:22:5
2+
--> $DIR/while_let_some_result.rs:23:5
33
|
44
LL | while let Some(a) = wat.next().ok() {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -10,13 +10,5 @@ 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: 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
13+
error: aborting due to previous error
2214

0 commit comments

Comments
 (0)