Skip to content

Commit

Permalink
update test option
Browse files Browse the repository at this point in the history
  • Loading branch information
disco07 committed May 15, 2023
1 parent c53ceba commit 79a8867
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 24 deletions.
5 changes: 2 additions & 3 deletions tests/ui/redundant_pattern_matching_option.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,14 @@ fn issue7921() {

fn issue10726() {
let x = Some(42);
let y = None::<()>;

x.is_some();

x.is_none();

y.is_some();
x.is_none();

y.is_none();
x.is_some();

// Don't lint
match x {
Expand Down
13 changes: 6 additions & 7 deletions tests/ui/redundant_pattern_matching_option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ fn issue7921() {

fn issue10726() {
let x = Some(42);
let y = None::<()>;

match x {
Some(_) => true,
Expand All @@ -119,14 +118,14 @@ fn issue10726() {
_ => false,
};

match y {
Some(_) => true,
_ => false,
match x {
Some(_) => false,
_ => true,
};

match y {
None => true,
_ => false,
match x {
None => false,
_ => true,
};

// Don't lint
Expand Down
28 changes: 14 additions & 14 deletions tests/ui/redundant_pattern_matching_option.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ LL | if let None = *&None::<()> {}
| -------^^^^--------------- help: try this: `if (&None::<()>).is_none()`

error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:112:5
--> $DIR/redundant_pattern_matching_option.rs:111:5
|
LL | / match x {
LL | | Some(_) => true,
Expand All @@ -158,31 +158,31 @@ LL | | };
| |_____^ help: try this: `x.is_some()`

error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:117:5
--> $DIR/redundant_pattern_matching_option.rs:116:5
|
LL | / match x {
LL | | None => true,
LL | | _ => false,
LL | | };
| |_____^ help: try this: `x.is_none()`

error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:122:5
error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:121:5
|
LL | / match y {
LL | | Some(_) => true,
LL | | _ => false,
LL | / match x {
LL | | Some(_) => false,
LL | | _ => true,
LL | | };
| |_____^ help: try this: `y.is_some()`
| |_____^ help: try this: `x.is_none()`

error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:127:5
error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:126:5
|
LL | / match y {
LL | | None => true,
LL | | _ => false,
LL | / match x {
LL | | None => false,
LL | | _ => true,
LL | | };
| |_____^ help: try this: `y.is_none()`
| |_____^ help: try this: `x.is_some()`

error: aborting due to 26 previous errors

0 comments on commit 79a8867

Please sign in to comment.