Tweak diagnostics

This commit is contained in:
Nadrieril 2020-12-19 17:48:31 +00:00
parent 5687c16279
commit 5b6c175566
2 changed files with 10 additions and 11 deletions

View File

@ -309,9 +309,7 @@ fn lint_overlapping_range_endpoints(
pcx.span,
|lint| {
let mut err = lint.build("multiple patterns overlap on their endpoints");
err.span_label(pcx.span, "... with this range");
for (int_range, span) in overlaps {
// Use the real type for user display of the ranges:
err.span_label(
span,
&format!(
@ -320,7 +318,8 @@ fn lint_overlapping_range_endpoints(
),
);
}
err.note("this is likely to be a mistake");
err.span_label(pcx.span, "... with this range");
err.note("you likely meant to write mutually exclusive ranges");
err.emit();
},
);

View File

@ -11,7 +11,7 @@ note: the lint level is defined here
|
LL | #![deny(overlapping_range_endpoints)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this is likely to be a mistake
= note: you likely meant to write mutually exclusive ranges
error: multiple patterns overlap on their endpoints
--> $DIR/overlapping_range_endpoints.rs:16:22
@ -21,7 +21,7 @@ LL | m!(0u8, 30..=40, 20..=30);
| |
| this range overlaps on `30_u8`...
|
= note: this is likely to be a mistake
= note: you likely meant to write mutually exclusive ranges
error: multiple patterns overlap on their endpoints
--> $DIR/overlapping_range_endpoints.rs:19:22
@ -31,7 +31,7 @@ LL | m!(0u8, 20.. 30, 29..=40);
| |
| this range overlaps on `29_u8`...
|
= note: this is likely to be a mistake
= note: you likely meant to write mutually exclusive ranges
error: multiple patterns overlap on their endpoints
--> $DIR/overlapping_range_endpoints.rs:23:22
@ -41,7 +41,7 @@ LL | m!(0u8, 20..=30, 30..=31);
| |
| this range overlaps on `30_u8`...
|
= note: this is likely to be a mistake
= note: you likely meant to write mutually exclusive ranges
error: multiple patterns overlap on their endpoints
--> $DIR/overlapping_range_endpoints.rs:27:22
@ -51,7 +51,7 @@ LL | m!(0u8, 20..=30, 19..=20);
| |
| this range overlaps on `20_u8`...
|
= note: this is likely to be a mistake
= note: you likely meant to write mutually exclusive ranges
error: multiple patterns overlap on their endpoints
--> $DIR/overlapping_range_endpoints.rs:39:9
@ -63,7 +63,7 @@ LL | 20..=30 => {}
LL | 10..=20 => {}
| ^^^^^^^ ... with this range
|
= note: this is likely to be a mistake
= note: you likely meant to write mutually exclusive ranges
error: multiple patterns overlap on their endpoints
--> $DIR/overlapping_range_endpoints.rs:50:16
@ -73,7 +73,7 @@ LL | (true, 0..=10) => {}
LL | (true, 10..20) => {}
| ^^^^^^ ... with this range
|
= note: this is likely to be a mistake
= note: you likely meant to write mutually exclusive ranges
error: multiple patterns overlap on their endpoints
--> $DIR/overlapping_range_endpoints.rs:56:14
@ -83,7 +83,7 @@ LL | Some(0..=10) => {}
LL | Some(10..20) => {}
| ^^^^^^ ... with this range
|
= note: this is likely to be a mistake
= note: you likely meant to write mutually exclusive ranges
error: aborting due to 8 previous errors