Static rustc_ap_rustc_lint_defs::builtin::OVERLAPPING_RANGE_ENDPOINTS[][src]

pub static OVERLAPPING_RANGE_ENDPOINTS: &Lint
Expand description

The overlapping_range_endpoints lint detects match arms that have range patterns that overlap on their endpoints.

Example

let x = 123u8;
match x {
    0..=100 => { println!("small"); }
    100..=255 => { println!("large"); }
}

{{produces}}

Explanation

It is likely a mistake to have range patterns in a match expression that overlap in this way. Check that the beginning and end values are what you expect, and keep in mind that with ..= the left and right bounds are inclusive.