diff options
| author | koka <koka.code@gmail.com> | 2022-12-10 21:05:08 +0900 |
|---|---|---|
| committer | koka <koka.code@gmail.com> | 2022-12-10 21:05:08 +0900 |
| commit | 055f349670155d88ae3a2f0a40baa47f524efa88 (patch) | |
| tree | f3863d2a57b2486ff18a80ed36236137ac827ad7 /tests | |
| parent | ef2018cc49ea1c5d0be5114c3e29a7f4fc10cc6e (diff) | |
| download | rust-055f349670155d88ae3a2f0a40baa47f524efa88.tar.gz rust-055f349670155d88ae3a2f0a40baa47f524efa88.zip | |
Avoid `match_wildcard_for_single_variants` on guarded wild matches
fix #9993 changlog: [`match_wildcard_for_single_variants`] avoid suggestion on wildcard with guard
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/match_wildcard_for_single_variants.fixed | 16 | ||||
| -rw-r--r-- | tests/ui/match_wildcard_for_single_variants.rs | 16 |
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/ui/match_wildcard_for_single_variants.fixed b/tests/ui/match_wildcard_for_single_variants.fixed index e675c183ea7..c508b7cc3b2 100644 --- a/tests/ui/match_wildcard_for_single_variants.fixed +++ b/tests/ui/match_wildcard_for_single_variants.fixed @@ -132,3 +132,19 @@ fn main() { } } } + +mod issue9993 { + enum Foo { + A(bool), + B, + } + + fn test() { + let _ = match Foo::A(true) { + _ if false => 0, + Foo::A(true) => 1, + Foo::A(false) => 2, + Foo::B => 3, + }; + } +} diff --git a/tests/ui/match_wildcard_for_single_variants.rs b/tests/ui/match_wildcard_for_single_variants.rs index 38c3ffc00c7..ad03f797129 100644 --- a/tests/ui/match_wildcard_for_single_variants.rs +++ b/tests/ui/match_wildcard_for_single_variants.rs @@ -132,3 +132,19 @@ fn main() { } } } + +mod issue9993 { + enum Foo { + A(bool), + B, + } + + fn test() { + let _ = match Foo::A(true) { + _ if false => 0, + Foo::A(true) => 1, + Foo::A(false) => 2, + Foo::B => 3, + }; + } +} |
