Skip to content

Commit 6034a69

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 b0183e5 commit 6034a69

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ impl DiagCtxt {
672672
let key = (span.with_parent(None), key);
673673

674674
if diag.is_error() {
675-
if diag.level == Error && diag.is_lint {
675+
if diag.is_lint {
676676
inner.lint_err_count += 1;
677677
} else {
678678
inner.err_count += 1;
@@ -691,7 +691,7 @@ impl DiagCtxt {
691691
let key = (span.with_parent(None), key);
692692
let diag = inner.stashed_diagnostics.remove(&key)?;
693693
if diag.is_error() {
694-
if diag.level == Error && diag.is_lint {
694+
if diag.is_lint {
695695
inner.lint_err_count -= 1;
696696
} else {
697697
inner.err_count -= 1;
@@ -1231,7 +1231,7 @@ impl DiagCtxtInner {
12311231
for diag in diags {
12321232
// Decrement the count tracking the stash; emitting will increment it.
12331233
if diag.is_error() {
1234-
if diag.level == Error && diag.is_lint {
1234+
if diag.is_lint {
12351235
self.lint_err_count -= 1;
12361236
} else {
12371237
self.err_count -= 1;
@@ -1344,7 +1344,7 @@ impl DiagCtxtInner {
13441344
self.has_printed = true;
13451345
}
13461346
if diagnostic.is_error() {
1347-
if diagnostic.level == Error && diagnostic.is_lint {
1347+
if diagnostic.is_lint {
13481348
self.bump_lint_err_count();
13491349
} else {
13501350
self.bump_err_count();

0 commit comments

Comments
 (0)