Be consistent about linting singletons

This commit is contained in:
Nadrieril 2020-10-22 19:25:55 +01:00
parent d1a50ffb7c
commit c89d439bb5
3 changed files with 4 additions and 20 deletions

View file

@ -161,7 +161,7 @@ impl IntRange {
// 2 -------- // 2 -------
let (lo, hi) = self.boundaries();
let (other_lo, other_hi) = other.boundaries();
lo == other_hi || hi == other_lo
(lo == other_hi || hi == other_lo) && !self.is_singleton() && !other.is_singleton()
}
fn to_pat<'tcx>(&self, tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Pat<'tcx> {

View file

@ -29,9 +29,9 @@ fn main() {
m!(0u8, 20..=30, 25);
m!(0u8, 20..=30, 30);
m!(0u8, 20.. 30, 29);
m!(0u8, 20, 20..=30); //~ ERROR multiple patterns overlap on their endpoints
m!(0u8, 20, 20..=30);
m!(0u8, 25, 20..=30);
m!(0u8, 30, 20..=30); //~ ERROR multiple patterns overlap on their endpoints
m!(0u8, 30, 20..=30);
match 0u8 {
0..=10 => {}

View file

@ -44,22 +44,6 @@ LL | m!(0u8, 20..=30, 19..=20);
| |
| this range overlaps on `20_u8`
error: multiple patterns overlap on their endpoints
--> $DIR/overlapping_range_endpoints.rs:32:17
|
LL | m!(0u8, 20, 20..=30);
| -- ^^^^^^^ overlapping range endpoints
| |
| this range overlaps on `20_u8`
error: multiple patterns overlap on their endpoints
--> $DIR/overlapping_range_endpoints.rs:34:17
|
LL | m!(0u8, 30, 20..=30);
| -- ^^^^^^^ overlapping range endpoints
| |
| this range overlaps on `30_u8`
error: multiple patterns overlap on their endpoints
--> $DIR/overlapping_range_endpoints.rs:39:9
|
@ -86,5 +70,5 @@ LL | Some(0..=10) => {}
LL | Some(10..20) => {}
| ^^^^^^ overlapping range endpoints
error: aborting due to 10 previous errors
error: aborting due to 8 previous errors