Inline and remove DiagCtxtInner::bump_{lint_err,err}_count.

They have one and two call sites respectively, and they just make the
code harder to read.
This commit is contained in:
Nicholas Nethercote 2024-01-10 14:27:02 +11:00
parent 65b323b168
commit f0a3684c1e

View File

@ -1168,7 +1168,8 @@ impl DiagCtxt {
let mut inner = self.inner.borrow_mut();
if loud && lint_level.is_error() {
inner.bump_err_count();
inner.err_count += 1;
inner.panic_if_treat_err_as_bug();
}
inner.emitter.emit_unused_externs(lint_level, unused_externs)
@ -1353,10 +1354,11 @@ impl DiagCtxtInner {
}
if diagnostic.is_error() {
if diagnostic.is_lint {
self.bump_lint_err_count();
self.lint_err_count += 1;
} else {
self.bump_err_count();
self.err_count += 1;
}
self.panic_if_treat_err_as_bug();
#[allow(deprecated)]
{
@ -1447,16 +1449,6 @@ impl DiagCtxtInner {
panic::panic_any(DelayedBugPanic);
}
fn bump_lint_err_count(&mut self) {
self.lint_err_count += 1;
self.panic_if_treat_err_as_bug();
}
fn bump_err_count(&mut self) {
self.err_count += 1;
self.panic_if_treat_err_as_bug();
}
fn panic_if_treat_err_as_bug(&self) {
if self.treat_err_as_bug() {
match (