RS.CLIPPY.MATCH_WILDCARD_FOR_SINGLE_VARIANTS

A wildcard enum match for a single variant

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: match_wildcard_for_single_variants. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for wildcard enum matches for a single variant.

Why is this bad?

New enum variants added by library updates can be missed.

Known problems

Suggested replacements may not use correct path to enum if it's not present in the current scope.

Example

match x {
    Foo::A => {},
    Foo::B => {},
    _ => {},
}

Use instead:

match x {
    Foo::A => {},
    Foo::B => {},
    Foo::C => {},
}