Static rustc_lint_defs::builtin::UNREACHABLE_PATTERNS

source ·
Expand description

The unreachable_patterns lint detects unreachable patterns.


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



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.