Skip to content

Commit dd61eba

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 56c3265 commit dd61eba

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;
@@ -1235,7 +1235,7 @@ impl DiagCtxtInner {
12351235
for diag in diags {
12361236
// Decrement the count tracking the stash; emitting will increment it.
12371237
if diag.is_error() {
1238-
if diag.level == Error && diag.is_lint {
1238+
if diag.is_lint {
12391239
self.lint_err_count -= 1;
12401240
} else {
12411241
self.err_count -= 1;
@@ -1352,7 +1352,7 @@ impl DiagCtxtInner {
13521352
self.has_printed = true;
13531353
}
13541354
if diagnostic.is_error() {
1355-
if diagnostic.level == Error && diagnostic.is_lint {
1355+
if diagnostic.is_lint {
13561356
self.bump_lint_err_count();
13571357
} else {
13581358
self.bump_err_count();

0 commit comments

Comments
 (0)