Remove unnecessary Level:: qualifiers.

We have `use Level::*;` in this file.
This commit is contained in:
Nicholas Nethercote 2024-03-01 09:54:00 +11:00
parent 1a1876c979
commit 721c741756

View File

@ -780,11 +780,11 @@ pub fn try_steal_modify_and_emit_err<F>(
let err = self.inner.borrow_mut().stashed_diagnostics.swap_remove(&key); let err = self.inner.borrow_mut().stashed_diagnostics.swap_remove(&key);
err.map(|(err, guar)| { err.map(|(err, guar)| {
// The use of `::<ErrorGuaranteed>` is safe because level is `Level::Error`. // The use of `::<ErrorGuaranteed>` is safe because level is `Level::Error`.
assert_eq!(err.level, Level::Error); assert_eq!(err.level, Error);
assert!(guar.is_some()); assert!(guar.is_some());
let mut err = Diag::<ErrorGuaranteed>::new_diagnostic(self, err); let mut err = Diag::<ErrorGuaranteed>::new_diagnostic(self, err);
modify_err(&mut err); modify_err(&mut err);
assert_eq!(err.level, Level::Error); assert_eq!(err.level, Error);
err.emit() err.emit()
}) })
} }
@ -803,7 +803,7 @@ pub fn try_steal_replace_and_emit_err(
let old_err = self.inner.borrow_mut().stashed_diagnostics.swap_remove(&key); let old_err = self.inner.borrow_mut().stashed_diagnostics.swap_remove(&key);
match old_err { match old_err {
Some((old_err, guar)) => { Some((old_err, guar)) => {
assert_eq!(old_err.level, Level::Error); assert_eq!(old_err.level, Error);
assert!(guar.is_some()); assert!(guar.is_some());
// Because `old_err` has already been counted, it can only be // Because `old_err` has already been counted, it can only be
// safely cancelled because the `new_err` supplants it. // safely cancelled because the `new_err` supplants it.
@ -1367,7 +1367,7 @@ fn emit_diagnostic(&mut self, mut diagnostic: DiagInner) -> Option<ErrorGuarante
} }
if diagnostic.has_future_breakage() { if diagnostic.has_future_breakage() {
// Future breakages aren't emitted if they're Level::Allow, // Future breakages aren't emitted if they're `Level::Allow`,
// but they still need to be constructed and stashed below, // but they still need to be constructed and stashed below,
// so they'll trigger the must_produce_diag check. // so they'll trigger the must_produce_diag check.
self.suppressed_expected_diag = true; self.suppressed_expected_diag = true;
@ -1453,7 +1453,7 @@ fn emit_diagnostic(&mut self, mut diagnostic: DiagInner) -> Option<ErrorGuarante
diagnostic.children.extract_if(already_emitted_sub).for_each(|_| {}); diagnostic.children.extract_if(already_emitted_sub).for_each(|_| {});
if already_emitted { if already_emitted {
let msg = "duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`"; let msg = "duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`";
diagnostic.sub(Level::Note, msg, MultiSpan::new()); diagnostic.sub(Note, msg, MultiSpan::new());
} }
if is_error { if is_error {
@ -1623,7 +1623,7 @@ fn flush_delayed(&mut self) {
bug.arg("level", bug.level); bug.arg("level", bug.level);
let msg = crate::fluent_generated::errors_invalid_flushed_delayed_diagnostic_level; let msg = crate::fluent_generated::errors_invalid_flushed_delayed_diagnostic_level;
let msg = self.eagerly_translate_for_subdiag(&bug, msg); // after the `arg` call let msg = self.eagerly_translate_for_subdiag(&bug, msg); // after the `arg` call
bug.sub(Level::Note, msg, bug.span.primary_span().unwrap().into()); bug.sub(Note, msg, bug.span.primary_span().unwrap().into());
} }
bug.level = Bug; bug.level = Bug;
@ -1671,7 +1671,7 @@ fn decorate(self, dcx: &DiagCtxtInner) -> DiagInner {
diag.arg("emitted_at", diag.emitted_at.clone()); diag.arg("emitted_at", diag.emitted_at.clone());
diag.arg("note", self.note); diag.arg("note", self.note);
let msg = dcx.eagerly_translate_for_subdiag(&diag, msg); // after the `arg` calls let msg = dcx.eagerly_translate_for_subdiag(&diag, msg); // after the `arg` calls
diag.sub(Level::Note, msg, diag.span.primary_span().unwrap_or(DUMMY_SP).into()); diag.sub(Note, msg, diag.span.primary_span().unwrap_or(DUMMY_SP).into());
diag diag
} }
} }