提交 c89d439b 编写于 作者: N Nadrieril

Be consistent about linting singletons

上级 d1a50ffb
...@@ -161,7 +161,7 @@ fn suspicious_intersection(&self, other: &Self) -> bool { ...@@ -161,7 +161,7 @@ fn suspicious_intersection(&self, other: &Self) -> bool {
// 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() { ...@@ -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); ...@@ -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) => {} ...@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册