From dd61eba3c381d190572edac7952ee1dc91b9c6d4 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 9 Jan 2024 15:20:34 +1100 Subject: [PATCH] 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`.) --- compiler/rustc_errors/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 69a565e1585..8fb539fc358 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -672,7 +672,7 @@ pub fn stash_diagnostic(&self, span: Span, key: StashKey, diag: Diagnostic) { let key = (span.with_parent(None), key); if diag.is_error() { - if diag.level == Error && diag.is_lint { + if diag.is_lint { inner.lint_err_count += 1; } else { inner.err_count += 1; @@ -691,7 +691,7 @@ pub fn steal_diagnostic(&self, span: Span, key: StashKey) -> Option Option { for diag in diags { // Decrement the count tracking the stash; emitting will increment it. if diag.is_error() { - if diag.level == Error && diag.is_lint { + if diag.is_lint { self.lint_err_count -= 1; } else { self.err_count -= 1; @@ -1352,7 +1352,7 @@ fn emit_diagnostic(&mut self, mut diagnostic: Diagnostic) -> Option