rustc_lint::builtin

Static OVERLAPPING_RANGE_ENDPOINTS

pub static OVERLAPPING_RANGE_ENDPOINTS: &'static 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.