Skip to content

Commit 0f9cd03

Browse files
committed
Simplify lint error counting.
Of the error levels satisfying `is_error`, `Level::Error` is the only one that can be a lint, so there's no need to check for it. (And even if it wasn't, it would make more sense to include non-`Error`-but-`is_error` lints under `lint_err_count` than under `err_count`.)
1 parent c949f24 commit 0f9cd03

File tree

1 file changed

+4
-4
lines changed
  • compiler/rustc_errors/src

1 file changed

+4
-4
lines changed

compiler/rustc_errors/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ impl DiagCtxt {
675675
let key = (span.with_parent(None), key);
676676

677677
if diag.is_error() {
678-
if diag.level == Error && diag.is_lint {
678+
if diag.is_lint {
679679
inner.lint_err_count += 1;
680680
} else {
681681
inner.err_count += 1;
@@ -694,7 +694,7 @@ impl DiagCtxt {
694694
let key = (span.with_parent(None), key);
695695
let diag = inner.stashed_diagnostics.remove(&key)?;
696696
if diag.is_error() {
697-
if diag.level == Error && diag.is_lint {
697+
if diag.is_lint {
698698
inner.lint_err_count -= 1;
699699
} else {
700700
inner.err_count -= 1;
@@ -1234,7 +1234,7 @@ impl DiagCtxtInner {
12341234
for diag in diags {
12351235
// Decrement the count tracking the stash; emitting will increment it.
12361236
if diag.is_error() {
1237-
if diag.level == Error && diag.is_lint {
1237+
if diag.is_lint {
12381238
self.lint_err_count -= 1;
12391239
} else {
12401240
self.err_count -= 1;
@@ -1347,7 +1347,7 @@ impl DiagCtxtInner {
13471347
self.has_printed = true;
13481348
}
13491349
if diagnostic.is_error() {
1350-
if diagnostic.level == Error && diagnostic.is_lint {
1350+
if diagnostic.is_lint {
13511351
self.bump_lint_err_count();
13521352
} else {
13531353
self.bump_err_count();

0 commit comments

Comments
 (0)