Remove return value from emit_stashed_diagnostics.

It's never used.
This commit is contained in:
Nicholas Nethercote 2024-02-06 17:13:32 +11:00
parent 0d531351e8
commit 8d1c20a539
2 changed files with 4 additions and 7 deletions

View file

@ -708,7 +708,7 @@ pub fn has_stashed_diagnostic(&self, span: Span, key: StashKey) -> bool {
} }
/// Emit all stashed diagnostics. /// Emit all stashed diagnostics.
pub fn emit_stashed_diagnostics(&self) -> Option<ErrorGuaranteed> { pub fn emit_stashed_diagnostics(&self) {
self.inner.borrow_mut().emit_stashed_diagnostics() self.inner.borrow_mut().emit_stashed_diagnostics()
} }
@ -1216,9 +1216,8 @@ pub fn flush_delayed(&self) {
// `DiagCtxtInner::foo`. // `DiagCtxtInner::foo`.
impl DiagCtxtInner { impl DiagCtxtInner {
/// Emit all stashed diagnostics. /// Emit all stashed diagnostics.
fn emit_stashed_diagnostics(&mut self) -> Option<ErrorGuaranteed> { fn emit_stashed_diagnostics(&mut self) {
let has_errors = self.has_errors(); let has_errors = self.has_errors();
let mut reported = None;
for (_, diag) in std::mem::take(&mut self.stashed_diagnostics).into_iter() { for (_, diag) in std::mem::take(&mut self.stashed_diagnostics).into_iter() {
// Decrement the count tracking the stash; emitting will increment it. // Decrement the count tracking the stash; emitting will increment it.
if diag.is_error() { if diag.is_error() {
@ -1235,10 +1234,8 @@ fn emit_stashed_diagnostics(&mut self) -> Option<ErrorGuaranteed> {
continue; continue;
} }
} }
let reported_this = self.emit_diagnostic(diag); self.emit_diagnostic(diag);
reported = reported.or(reported_this);
} }
reported
} }
fn emit_diagnostic(&mut self, mut diagnostic: Diagnostic) -> Option<ErrorGuaranteed> { fn emit_diagnostic(&mut self, mut diagnostic: Diagnostic) -> Option<ErrorGuaranteed> {

View file

@ -315,7 +315,7 @@ pub fn create_feature_err<'a>(
pub fn compile_status(&self) -> Result<(), ErrorGuaranteed> { pub fn compile_status(&self) -> Result<(), ErrorGuaranteed> {
// We must include lint errors here. // We must include lint errors here.
if let Some(reported) = self.dcx().has_errors_or_lint_errors() { if let Some(reported) = self.dcx().has_errors_or_lint_errors() {
let _ = self.dcx().emit_stashed_diagnostics(); self.dcx().emit_stashed_diagnostics();
Err(reported) Err(reported)
} else { } else {
Ok(()) Ok(())