Skip to content

Commit

Permalink
Rollup merge of rust-lang#62971 - GuillaumeGomez:keyword-sidebar, r=n…
Browse files Browse the repository at this point in the history
…obody

Add keywords item into the sidebar

Fixes rust-lang#62939.

cc @pravic

screenshot of the result:

![Screenshot from 2019-07-25 14-29-48](https://user-images.githubusercontent.com/3050060/61874545-f9512080-aee8-11e9-8e8b-aa50216aec94.png)

r? @QuietMisdreavus
  • Loading branch information
Centril authored Aug 1, 2019
2 parents 757a14a + 08a8de8 commit 7bd956e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5007,7 +5007,8 @@ fn sidebar_module(fmt: &mut fmt::Formatter<'_>, _it: &clean::Item,
ItemType::Enum, ItemType::Constant, ItemType::Static, ItemType::Trait,
ItemType::Function, ItemType::Typedef, ItemType::Union, ItemType::Impl,
ItemType::TyMethod, ItemType::Method, ItemType::StructField, ItemType::Variant,
ItemType::AssocType, ItemType::AssocConst, ItemType::ForeignType] {
ItemType::AssocType, ItemType::AssocConst, ItemType::ForeignType,
ItemType::Keyword] {
if items.iter().any(|it| !it.is_stripped() && it.type_() == myty) {
let (short, name) = item_ty_to_strs(&myty);
sidebar.push_str(&format!("<li><a href=\"#{id}\">{name}</a></li>",
Expand Down
1 change: 1 addition & 0 deletions src/test/rustdoc/keyword.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// @has foo/index.html '//h2[@id="keywords"]' 'Keywords'
// @has foo/index.html '//a[@href="keyword.match.html"]' 'match'
// @has foo/index.html '//div[@class="block items"]//a/@href' '#keywords'
// @has foo/keyword.match.html '//a[@class="keyword"]' 'match'
// @has foo/keyword.match.html '//span[@class="in-band"]' 'Keyword match'
// @has foo/keyword.match.html '//section[@id="main"]//div[@class="docblock"]//p' 'this is a test!'
Expand Down

0 comments on commit 7bd956e

Please sign in to comment.