about summary refs log tree commit diff
path: root/src/librustdoc
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-01-17 06:08:10 +0100
committerGitHub <noreply@github.com>2022-01-17 06:08:10 +0100
commit869b7bc5e7534acc2a38d0f389e1ef0ef2bb44e6 (patch)
treec98256951e85caa0c08e90e29e8b175055052a91 /src/librustdoc
parent1fbd6aedb3474d2a5d70839a42c80d869749d8ff (diff)
parent7781636fc7bd2edc6bf314dc15eb8e9d5cb60ce6 (diff)
downloadrust-869b7bc5e7534acc2a38d0f389e1ef0ef2bb44e6.tar.gz
rust-869b7bc5e7534acc2a38d0f389e1ef0ef2bb44e6.zip
Rollup merge of #92795 - jsha:link-to-top, r=GuillaumeGomez
Link sidebar "location" heading to top of page

This makes it easy, when you are scrolled far down in a page, to jump back to the top.

Demo: https://rustdoc.crud.net/jsha/link-to-top/std/string/struct.String.html

r? ``@GuillaumeGomez``
Diffstat (limited to 'src/librustdoc')
-rw-r--r--src/librustdoc/html/render/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index f0cbe79bd06..7f3e5d15de1 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -1736,7 +1736,7 @@ fn print_sidebar(cx: &Context<'_>, it: &clean::Item, buffer: &mut Buffer) {
     {
         write!(
             buffer,
-            "<h2 class=\"location\">{}{}</h2>",
+            "<h2 class=\"location\"><a href=\"#\">{}{}</a></h2>",
             match *it.kind {
                 clean::StructItem(..) => "Struct ",
                 clean::TraitItem(..) => "Trait ",