RS.CLIPPY.WILDCARD_IN_OR_PATTERNS

A wildcard pattern used with others patterns in same match arm

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

What it does

Checks for wildcard pattern used with others patterns in same match arm.

Why is this bad?

Wildcard pattern already covers any other pattern as it will match anyway. It makes the code less readable, especially to spot wildcard pattern use in match arm.

Example

match s {
    "a" => {},
    "bar" | _ => {},
}

Use instead:

match s {
    "a" => {},
    _ => {},
}