From 9f02e1a938087153e1d6440e217681ae0d079c69 Mon Sep 17 00:00:00 2001 From: Vitaly _Vi Shukela Date: Fri, 29 Sep 2017 14:29:09 +0300 Subject: [PATCH] rustdoc: Render [src] links for trait implementors (#43893) --- src/librustdoc/html/render.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index d58cfcf18b62..a3f446885f96 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -2489,7 +2489,16 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, write!(w, "{}", impl_header)?; for implementor in local { - write!(w, "
  • ")?; + write!(w, "
  • ")?; + if let Some(item) = implementor2item(&cache, implementor) { + if let Some(l) = (Item { cx, item }).src_href() { + write!(w, "
    ")?; + write!(w, "[src]", + l, "goto source code")?; + write!(w, "
    ")?; + } + } + write!(w, "")?; // If there's already another implementor that has the same abbridged name, use the // full path, for example in `std::iter::ExactSizeIterator` let use_absolute = match implementor.impl_.for_ {