Skip to content

Commit ef0d909

Browse files
formatting
1 parent f233a70 commit ef0d909

File tree

2 files changed

+19
-30
lines changed

2 files changed

+19
-30
lines changed

src/librustdoc/html/highlight.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -573,24 +573,20 @@ fn string<T: Display>(
573573
});
574574
}
575575
if let Some(context_info) = context_info {
576-
if let Some(href) = context_info
577-
.context
578-
.shared
579-
.span_correspondance_map
580-
.get(&def_span)
581-
.and_then(|href| {
582-
let context = context_info.context;
583-
match href {
584-
LinkFromSrc::Local(span) => {
585-
context
576+
if let Some(href) =
577+
context_info.context.shared.span_correspondance_map.get(&def_span).and_then(
578+
|href| {
579+
let context = context_info.context;
580+
match href {
581+
LinkFromSrc::Local(span) => context
586582
.href_from_span(*span)
587-
.map(|s| format!("{}{}", context_info.root_path, s))
583+
.map(|s| format!("{}{}", context_info.root_path, s)),
584+
LinkFromSrc::External(def_id) => {
585+
format::href(*def_id, context).map(|(url, _, _)| url)
586+
}
588587
}
589-
LinkFromSrc::External(def_id) => {
590-
format::href(*def_id, context).map(|(url, _, _)| url)
591-
}
592-
}
593-
})
588+
},
589+
)
594590
{
595591
write!(out, "<a class=\"{}\" href=\"{}\">{}</a>", klass.as_html(), href, text);
596592
return;

src/librustdoc/html/render/span_map.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -183,20 +183,13 @@ impl Visitor<'tcx> for SpanMapVisitor<'tcx> {
183183
hir.maybe_body_owned_by(body_id).expect("a body which isn't a body"),
184184
);
185185
if let Some(def_id) = typeck_results.type_dependent_def_id(expr.hir_id) {
186-
match hir.span_if_local(def_id) {
187-
Some(span) => {
188-
self.matches.insert(
189-
LightSpan::new_from_span(method_span),
190-
LinkFromSrc::Local(clean::Span::new(span)),
191-
);
192-
}
193-
None => {
194-
self.matches.insert(
195-
LightSpan::new_from_span(method_span),
196-
LinkFromSrc::External(def_id),
197-
);
198-
}
199-
}
186+
self.matches.insert(
187+
LightSpan::new_from_span(method_span),
188+
match hir.span_if_local(def_id) {
189+
Some(span) => LinkFromSrc::Local(clean::Span::new(span)),
190+
None => LinkFromSrc::External(def_id),
191+
},
192+
);
200193
}
201194
}
202195
}

0 commit comments

Comments
 (0)