Be consistent about linting singletons
This commit is contained in:
parent
d1a50ffb7c
commit
c89d439bb5
3 changed files with 4 additions and 20 deletions
|
@ -161,7 +161,7 @@ impl IntRange {
|
||||||
// 2 -------- // 2 -------
|
// 2 -------- // 2 -------
|
||||||
let (lo, hi) = self.boundaries();
|
let (lo, hi) = self.boundaries();
|
||||||
let (other_lo, other_hi) = other.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> {
|
fn to_pat<'tcx>(&self, tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Pat<'tcx> {
|
||||||
|
|
|
@ -29,9 +29,9 @@ fn main() {
|
||||||
m!(0u8, 20..=30, 25);
|
m!(0u8, 20..=30, 25);
|
||||||
m!(0u8, 20..=30, 30);
|
m!(0u8, 20..=30, 30);
|
||||||
m!(0u8, 20.. 30, 29);
|
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, 25, 20..=30);
|
||||||
m!(0u8, 30, 20..=30); //~ ERROR multiple patterns overlap on their endpoints
|
m!(0u8, 30, 20..=30);
|
||||||
|
|
||||||
match 0u8 {
|
match 0u8 {
|
||||||
0..=10 => {}
|
0..=10 => {}
|
||||||
|
|
|
@ -44,22 +44,6 @@ LL | m!(0u8, 20..=30, 19..=20);
|
||||||
| |
|
| |
|
||||||
| this range overlaps on `20_u8`
|
| 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
|
error: multiple patterns overlap on their endpoints
|
||||||
--> $DIR/overlapping_range_endpoints.rs:39:9
|
--> $DIR/overlapping_range_endpoints.rs:39:9
|
||||||
|
|
|
|
||||||
|
@ -86,5 +70,5 @@ LL | Some(0..=10) => {}
|
||||||
LL | Some(10..20) => {}
|
LL | Some(10..20) => {}
|
||||||
| ^^^^^^ overlapping range endpoints
|
| ^^^^^^ overlapping range endpoints
|
||||||
|
|
||||||
error: aborting due to 10 previous errors
|
error: aborting due to 8 previous errors
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue