rustc_lint::builtin

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.