UNREACHABLE_PATTERNS in rustc_lint::builtin - Rust
Description: The `unreachable_patterns` lint detects unreachable patterns.

Skip to main content

## UNREACHABLE_PATTERNS

# Static UNREACHABLE_PATTERNS

Source

    pub static UNREACHABLE_PATTERNS: &'static Lint

Expand description

The `unreachable_patterns` lint detects unreachable patterns.

#### §Example

    let x = 5;
    match x {
        y => (),
        5 => (),
    }

{{produces}}

#### §Explanation

This usually indicates a mistake in how the patterns are specified or ordered. In this example, the `y` pattern will always match, so the five is impossible to reach. Remember, match arms match in order, you probably wanted to put the `5` case above the `y` case.