diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2020-01-15 17:50:26 +0200 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2020-02-06 21:32:07 +0200 |
| commit | 5eaa9a150d470019ac0924ece7a23a0d1cefe5f4 (patch) | |
| tree | 708c01acbaf57b1c07b872f41549be34569d869f /src | |
| parent | f6fc80206e9600ae753cdfbd762fb982afca48b0 (diff) | |
| download | rust-5eaa9a150d470019ac0924ece7a23a0d1cefe5f4.tar.gz rust-5eaa9a150d470019ac0924ece7a23a0d1cefe5f4.zip | |
rustc_errors: deduplicate the -Zmacro-backtrace suggestion message.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_errors/emitter.rs | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 59493b4a683..a57b59a1962 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -14,7 +14,6 @@ use rustc_span::{MultiSpan, SourceFile, Span}; use crate::snippet::{Annotation, AnnotationType, Line, MultilineAnnotation, Style, StyledString}; use crate::styled_buffer::StyledBuffer; -use crate::Level::Error; use crate::{ pluralize, CodeSuggestion, Diagnostic, DiagnosticId, Level, SubDiagnostic, SuggestionStyle, }; @@ -284,17 +283,11 @@ pub trait Emitter { if !backtrace { if self.fix_multispans_in_extern_macros(source_map, span, children) { - let msg = if level == &Error { - "this error originates in a macro outside of the current crate \ - (in Nightly builds, run with -Z macro-backtrace \ - for more info)" - .to_string() - } else { - "this warning originates in a macro outside of the current crate \ - (in Nightly builds, run with -Z macro-backtrace \ - for more info)" - .to_string() - }; + let msg = format!( + "this {} originates in a macro outside of the current crate \ + (in Nightly builds, run with -Z macro-backtrace for more info)", + level, + ); children.push(SubDiagnostic { level: Level::Note, |
