diff options
| -rw-r--r-- | tests/ui/single_match.rs | 10 | ||||
| -rw-r--r-- | tests/ui/single_match.stderr | 6 |
2 files changed, 9 insertions, 7 deletions
diff --git a/tests/ui/single_match.rs b/tests/ui/single_match.rs index aa93f4d8ca5..0e50b3e4a6e 100644 --- a/tests/ui/single_match.rs +++ b/tests/ui/single_match.rs @@ -152,7 +152,9 @@ fn ranges() { } let x = (Some(E::V), Some(42)); - // don't lint + // Don't lint, because the `E` enum can be extended with additional fields later. Thus, the + // proposed replacement to `if let Some(E::V)` may hide non-exhaustive warnings that appeared + // because of `match` construction. match x { (Some(E::V), _) => {}, (None, _) => {}, @@ -176,19 +178,19 @@ fn ranges() { (..) => {}, } - // don't lint + // Don't lint, see above. match (Some(E::V), Some(E::V), Some(E::V)) { (.., Some(E::V), _) => {}, (.., None, _) => {}, } - // don't lint + // Don't lint, see above. match (Some(E::V), Some(E::V), Some(E::V)) { (Some(E::V), ..) => {}, (None, ..) => {}, } - // don't lint + // Don't lint, see above. match (Some(E::V), Some(E::V), Some(E::V)) { (_, Some(E::V), ..) => {}, (_, None, ..) => {}, diff --git a/tests/ui/single_match.stderr b/tests/ui/single_match.stderr index f72ad853fed..318faf25717 100644 --- a/tests/ui/single_match.stderr +++ b/tests/ui/single_match.stderr @@ -120,7 +120,7 @@ LL | | }; | |_____^ help: try this: `if let None = x { println!() }` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> $DIR/single_match.rs:162:5 + --> $DIR/single_match.rs:164:5 | LL | / match x { LL | | (Some(_), _) => {}, @@ -129,7 +129,7 @@ LL | | } | |_____^ help: try this: `if let (Some(_), _) = x {}` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> $DIR/single_match.rs:168:5 + --> $DIR/single_match.rs:170:5 | LL | / match x { LL | | (Some(E::V), _) => todo!(), @@ -138,7 +138,7 @@ LL | | } | |_____^ help: try this: `if let (Some(E::V), _) = x { todo!() }` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> $DIR/single_match.rs:174:5 + --> $DIR/single_match.rs:176:5 | LL | / match (Some(42), Some(E::V), Some(42)) { LL | | (.., Some(E::V), _) => {}, |
