diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2025-06-21 16:52:03 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-21 16:52:03 +0000 |
| commit | a421ffbadb2b1de1ec570f2c763b25fbd3aed9d5 (patch) | |
| tree | 4d1a76b9757bba466007fb7b645f9da15d87d055 /tests | |
| parent | 6330f9119b5fd0903ada2f9b2b976e718facd35a (diff) | |
| parent | e50ef68f0c617a3024dd1bcbf7941977f21028e1 (diff) | |
| download | rust-a421ffbadb2b1de1ec570f2c763b25fbd3aed9d5.tar.gz rust-a421ffbadb2b1de1ec570f2c763b25fbd3aed9d5.zip | |
Fix `wildcard_enum_match_arm` suggests wrongly with raw identifiers (#15093)
Closes rust-lang/rust-clippy#15091 The lack of ability to escape raw identifiers is a known issue of Clippy. In this case, it can be avoided by snippet from the code. changelog: [`wildcard_enum_match_arm`] fix wrong suggestions with raw identifiers
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/wildcard_enum_match_arm.fixed | 14 | ||||
| -rw-r--r-- | tests/ui/wildcard_enum_match_arm.rs | 14 | ||||
| -rw-r--r-- | tests/ui/wildcard_enum_match_arm.stderr | 8 |
3 files changed, 35 insertions, 1 deletions
diff --git a/tests/ui/wildcard_enum_match_arm.fixed b/tests/ui/wildcard_enum_match_arm.fixed index 141ff6eb2ac..e40e5267383 100644 --- a/tests/ui/wildcard_enum_match_arm.fixed +++ b/tests/ui/wildcard_enum_match_arm.fixed @@ -105,3 +105,17 @@ fn main() { } } } + +fn issue15091() { + enum Foo { + A, + B, + C, + } + + match Foo::A { + Foo::A => {}, + r#type @ Foo::B | r#type @ Foo::C => {}, + //~^ wildcard_enum_match_arm + } +} diff --git a/tests/ui/wildcard_enum_match_arm.rs b/tests/ui/wildcard_enum_match_arm.rs index a13684e9100..8259f059847 100644 --- a/tests/ui/wildcard_enum_match_arm.rs +++ b/tests/ui/wildcard_enum_match_arm.rs @@ -105,3 +105,17 @@ fn main() { } } } + +fn issue15091() { + enum Foo { + A, + B, + C, + } + + match Foo::A { + Foo::A => {}, + r#type => {}, + //~^ wildcard_enum_match_arm + } +} diff --git a/tests/ui/wildcard_enum_match_arm.stderr b/tests/ui/wildcard_enum_match_arm.stderr index 088c6b7b284..1f1de166d00 100644 --- a/tests/ui/wildcard_enum_match_arm.stderr +++ b/tests/ui/wildcard_enum_match_arm.stderr @@ -40,5 +40,11 @@ error: wildcard match will also match any future added variants LL | _ => (), | ^ help: try: `Enum::B | Enum::__Private` -error: aborting due to 6 previous errors +error: wildcard match will also match any future added variants + --> tests/ui/wildcard_enum_match_arm.rs:118:9 + | +LL | r#type => {}, + | ^^^^^^ help: try: `r#type @ Foo::B | r#type @ Foo::C` + +error: aborting due to 7 previous errors |
