Skip to content

Commit 5eaa9a1

Browse files
committed
rustc_errors: deduplicate the -Zmacro-backtrace suggestion message.
1 parent f6fc802 commit 5eaa9a1

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/librustc_errors/emitter.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use rustc_span::{MultiSpan, SourceFile, Span};
1414

1515
use crate::snippet::{Annotation, AnnotationType, Line, MultilineAnnotation, Style, StyledString};
1616
use crate::styled_buffer::StyledBuffer;
17-
use crate::Level::Error;
1817
use crate::{
1918
pluralize, CodeSuggestion, Diagnostic, DiagnosticId, Level, SubDiagnostic, SuggestionStyle,
2019
};
@@ -284,17 +283,11 @@ pub trait Emitter {
284283

285284
if !backtrace {
286285
if self.fix_multispans_in_extern_macros(source_map, span, children) {
287-
let msg = if level == &Error {
288-
"this error originates in a macro outside of the current crate \
289-
(in Nightly builds, run with -Z macro-backtrace \
290-
for more info)"
291-
.to_string()
292-
} else {
293-
"this warning originates in a macro outside of the current crate \
294-
(in Nightly builds, run with -Z macro-backtrace \
295-
for more info)"
296-
.to_string()
297-
};
286+
let msg = format!(
287+
"this {} originates in a macro outside of the current crate \
288+
(in Nightly builds, run with -Z macro-backtrace for more info)",
289+
level,
290+
);
298291

299292
children.push(SubDiagnostic {
300293
level: Level::Note,

0 commit comments

Comments
 (0)