update tests

This commit is contained in:
disco07 2023-05-11 07:20:02 +02:00
parent 3991dd10b5
commit c53ceba56f
3 changed files with 30 additions and 22 deletions

View File

@ -91,15 +91,19 @@ fn issue7921() {
} }
fn issue10726() { fn issue10726() {
Some(42).is_some(); let x = Some(42);
let y = None::<()>;
Some(42).is_none(); x.is_some();
None::<()>.is_some(); x.is_none();
None::<()>.is_none(); y.is_some();
match Some(42) { y.is_none();
// Don't lint
match x {
Some(21) => true, Some(21) => true,
_ => false, _ => false,
}; };

View File

@ -106,27 +106,31 @@ fn issue7921() {
} }
fn issue10726() { fn issue10726() {
match Some(42) { let x = Some(42);
let y = None::<()>;
match x {
Some(_) => true, Some(_) => true,
_ => false, _ => false,
}; };
match Some(42) { match x {
None => true, None => true,
_ => false, _ => false,
}; };
match None::<()> { match y {
Some(_) => true, Some(_) => true,
_ => false, _ => false,
}; };
match None::<()> { match y {
None => true, None => true,
_ => false, _ => false,
}; };
match Some(42) { // Don't lint
match x {
Some(21) => true, Some(21) => true,
_ => false, _ => false,
}; };

View File

@ -149,40 +149,40 @@ LL | if let None = *&None::<()> {}
| -------^^^^--------------- help: try this: `if (&None::<()>).is_none()` | -------^^^^--------------- help: try this: `if (&None::<()>).is_none()`
error: redundant pattern matching, consider using `is_some()` error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:109:5 --> $DIR/redundant_pattern_matching_option.rs:112:5
| |
LL | / match Some(42) { LL | / match x {
LL | | Some(_) => true, LL | | Some(_) => true,
LL | | _ => false, LL | | _ => false,
LL | | }; LL | | };
| |_____^ help: try this: `Some(42).is_some()` | |_____^ help: try this: `x.is_some()`
error: redundant pattern matching, consider using `is_none()` error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:114:5 --> $DIR/redundant_pattern_matching_option.rs:117:5
| |
LL | / match Some(42) { LL | / match x {
LL | | None => true, LL | | None => true,
LL | | _ => false, LL | | _ => false,
LL | | }; LL | | };
| |_____^ help: try this: `Some(42).is_none()` | |_____^ help: try this: `x.is_none()`
error: redundant pattern matching, consider using `is_some()` error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:119:5 --> $DIR/redundant_pattern_matching_option.rs:122:5
| |
LL | / match None::<()> { LL | / match y {
LL | | Some(_) => true, LL | | Some(_) => true,
LL | | _ => false, LL | | _ => false,
LL | | }; LL | | };
| |_____^ help: try this: `None::<()>.is_some()` | |_____^ help: try this: `y.is_some()`
error: redundant pattern matching, consider using `is_none()` error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:124:5 --> $DIR/redundant_pattern_matching_option.rs:127:5
| |
LL | / match None::<()> { LL | / match y {
LL | | None => true, LL | | None => true,
LL | | _ => false, LL | | _ => false,
LL | | }; LL | | };
| |_____^ help: try this: `None::<()>.is_none()` | |_____^ help: try this: `y.is_none()`
error: aborting due to 26 previous errors error: aborting due to 26 previous errors