Emit lints in the order in which they occur in the file.
This commit is contained in:
parent
25e272e388
commit
107a29a901
2 changed files with 11 additions and 10 deletions
|
@ -390,12 +390,13 @@ fn check_arms<'p, 'tcx>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Useful(unreachables) => {
|
Useful(unreachables) => {
|
||||||
for set in unreachables {
|
let mut unreachables: Vec<_> = unreachables.into_iter().flatten().collect();
|
||||||
for span in set {
|
// Emit lints in the order in which they occur in the file.
|
||||||
|
unreachables.sort_unstable();
|
||||||
|
for span in unreachables {
|
||||||
unreachable_pattern(cx.tcx, span, id, None);
|
unreachable_pattern(cx.tcx, span, id, None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
UsefulWithWitness(_) => bug!(),
|
UsefulWithWitness(_) => bug!(),
|
||||||
}
|
}
|
||||||
if !has_guard {
|
if !has_guard {
|
||||||
|
|
|
@ -76,18 +76,18 @@ error: unreachable pattern
|
||||||
LL | (1 | 1,) => {}
|
LL | (1 | 1,) => {}
|
||||||
| ^
|
| ^
|
||||||
|
|
||||||
error: unreachable pattern
|
|
||||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:55:15
|
|
||||||
|
|
|
||||||
LL | | 0] => {}
|
|
||||||
| ^
|
|
||||||
|
|
||||||
error: unreachable pattern
|
error: unreachable pattern
|
||||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:53:15
|
--> $DIR/exhaustiveness-unreachable-pattern.rs:53:15
|
||||||
|
|
|
|
||||||
LL | | 0
|
LL | | 0
|
||||||
| ^
|
| ^
|
||||||
|
|
||||||
|
error: unreachable pattern
|
||||||
|
--> $DIR/exhaustiveness-unreachable-pattern.rs:55:15
|
||||||
|
|
|
||||||
|
LL | | 0] => {}
|
||||||
|
| ^
|
||||||
|
|
||||||
error: unreachable pattern
|
error: unreachable pattern
|
||||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:63:10
|
--> $DIR/exhaustiveness-unreachable-pattern.rs:63:10
|
||||||
|
|
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue