From 32dc78ede8c3e96475d2fbe818d25bb01faec3ad Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 4 Dec 2023 08:49:18 +1100 Subject: [PATCH] Avoid `Diagnostic::new_with_code(..., None, ...)`. `Diagnostic::new` can be used instead. --- compiler/rustc_errors/src/diagnostic_builder.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs index 1366ef52261..354fe1da2c9 100644 --- a/compiler/rustc_errors/src/diagnostic_builder.rs +++ b/compiler/rustc_errors/src/diagnostic_builder.rs @@ -188,7 +188,7 @@ impl<'a> DiagnosticBuilder<'a, ()> { level: Level, message: M, ) -> Self { - let diagnostic = Diagnostic::new_with_code(level, None, message); + let diagnostic = Diagnostic::new(level, message); Self::new_diagnostic(handler, diagnostic) } @@ -257,7 +257,7 @@ impl EmissionGuarantee for Noted { DiagnosticBuilder { inner: DiagnosticBuilderInner { state: DiagnosticBuilderState::Emittable(handler), - diagnostic: Box::new(Diagnostic::new_with_code(Level::Note, None, msg)), + diagnostic: Box::new(Diagnostic::new(Level::Note, msg)), }, _marker: PhantomData, } @@ -292,7 +292,7 @@ impl EmissionGuarantee for Bug { DiagnosticBuilder { inner: DiagnosticBuilderInner { state: DiagnosticBuilderState::Emittable(handler), - diagnostic: Box::new(Diagnostic::new_with_code(Level::Bug, None, msg)), + diagnostic: Box::new(Diagnostic::new(Level::Bug, msg)), }, _marker: PhantomData, } @@ -322,7 +322,7 @@ impl EmissionGuarantee for ! { DiagnosticBuilder { inner: DiagnosticBuilderInner { state: DiagnosticBuilderState::Emittable(handler), - diagnostic: Box::new(Diagnostic::new_with_code(Level::Fatal, None, msg)), + diagnostic: Box::new(Diagnostic::new(Level::Fatal, msg)), }, _marker: PhantomData, } @@ -352,7 +352,7 @@ impl EmissionGuarantee for rustc_span::fatal_error::FatalError { DiagnosticBuilder { inner: DiagnosticBuilderInner { state: DiagnosticBuilderState::Emittable(handler), - diagnostic: Box::new(Diagnostic::new_with_code(Level::Fatal, None, msg)), + diagnostic: Box::new(Diagnostic::new(Level::Fatal, msg)), }, _marker: PhantomData, }