Skip to content

Commit 014f7f4

Browse files
committed
Remove some redundant arguments
1 parent 11fa085 commit 014f7f4

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ impl Emitter for AnnotateSnippetEmitterWriter {
5252
let (mut primary_span, suggestions) = self.primary_span_formatted(&diag, &fluent_args);
5353

5454
self.fix_multispans_in_extern_macros_and_render_macro_backtrace(
55-
&self.source_map,
5655
&mut primary_span,
5756
&mut children,
5857
&diag.level,

compiler/rustc_errors/src/emitter.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ pub trait Emitter: Translate {
314314

315315
fn fix_multispans_in_extern_macros_and_render_macro_backtrace(
316316
&self,
317-
source_map: &Option<Lrc<SourceMap>>,
318317
span: &mut MultiSpan,
319318
children: &mut Vec<SubDiagnostic>,
320319
level: &Level,
@@ -340,7 +339,7 @@ pub trait Emitter: Translate {
340339
.collect();
341340

342341
if !backtrace {
343-
self.fix_multispans_in_extern_macros(source_map, span, children);
342+
self.fix_multispans_in_extern_macros(span, children);
344343
}
345344

346345
self.render_multispans_macro_backtrace(span, children, backtrace);
@@ -480,23 +479,22 @@ pub trait Emitter: Translate {
480479
// this will change the span to point at the use site.
481480
fn fix_multispans_in_extern_macros(
482481
&self,
483-
source_map: &Option<Lrc<SourceMap>>,
484482
span: &mut MultiSpan,
485483
children: &mut Vec<SubDiagnostic>,
486484
) {
487-
let Some(source_map) = source_map else { return };
488485
debug!("fix_multispans_in_extern_macros: before: span={:?} children={:?}", span, children);
489-
self.fix_multispan_in_extern_macros(source_map, span);
486+
self.fix_multispan_in_extern_macros(span);
490487
for child in children.iter_mut() {
491-
self.fix_multispan_in_extern_macros(source_map, &mut child.span);
488+
self.fix_multispan_in_extern_macros(&mut child.span);
492489
}
493490
debug!("fix_multispans_in_extern_macros: after: span={:?} children={:?}", span, children);
494491
}
495492

496493
// This "fixes" MultiSpans that contain `Span`s pointing to locations inside of external macros.
497494
// Since these locations are often difficult to read,
498495
// we move these spans from the external macros to their corresponding use site.
499-
fn fix_multispan_in_extern_macros(&self, source_map: &Lrc<SourceMap>, span: &mut MultiSpan) {
496+
fn fix_multispan_in_extern_macros(&self, span: &mut MultiSpan) {
497+
let Some(source_map) = self.source_map() else { return };
500498
// First, find all the spans in external macros and point instead at their use site.
501499
let replacements: Vec<(Span, Span)> = span
502500
.primary_spans()
@@ -544,7 +542,6 @@ impl Emitter for EmitterWriter {
544542
debug!("emit_diagnostic: suggestions={:?}", suggestions);
545543

546544
self.fix_multispans_in_extern_macros_and_render_macro_backtrace(
547-
&self.sm,
548545
&mut primary_span,
549546
&mut children,
550547
&diag.level,

0 commit comments

Comments
 (0)