1
Fork 0

rustdoc: make the header show all three buttons

This tweaks it to use less space for the breadcrumbs.
This commit is contained in:
Michael Howell 2024-09-02 19:42:28 -07:00
parent d05323c7b4
commit 5b1b2e97e3
26 changed files with 154 additions and 102 deletions

View file

@ -2,15 +2,18 @@
//@ has 'empty_mod_private/index.html' '//a[@href="foo/index.html"]' 'foo'
//@ hasraw 'empty_mod_private/sidebar-items.js' 'foo'
//@ matches 'empty_mod_private/foo/index.html' '//h1' 'Module empty_mod_private::foo'
//@ matches 'empty_mod_private/foo/index.html' '//h1' 'Module foo'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private::'
mod foo {}
//@ has 'empty_mod_private/index.html' '//a[@href="bar/index.html"]' 'bar'
//@ hasraw 'empty_mod_private/sidebar-items.js' 'bar'
//@ matches 'empty_mod_private/bar/index.html' '//h1' 'Module empty_mod_private::bar'
//@ matches 'empty_mod_private/bar/index.html' '//h1' 'Module bar'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private::'
mod bar {
//@ has 'empty_mod_private/bar/index.html' '//a[@href="baz/index.html"]' 'baz'
//@ hasraw 'empty_mod_private/bar/sidebar-items.js' 'baz'
//@ matches 'empty_mod_private/bar/baz/index.html' '//h1' 'Module empty_mod_private::bar::baz'
//@ matches 'empty_mod_private/bar/baz/index.html' '//h1' 'Module baz'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private::bar::'
mod baz {}
}

View file

@ -1,14 +1,17 @@
//@ has 'empty_mod_public/index.html' '//a[@href="foo/index.html"]' 'foo'
//@ hasraw 'empty_mod_public/sidebar-items.js' 'foo'
//@ matches 'empty_mod_public/foo/index.html' '//h1' 'Module empty_mod_public::foo'
//@ matches 'empty_mod_public/foo/index.html' '//h1' 'Module foo'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_public::'
pub mod foo {}
//@ has 'empty_mod_public/index.html' '//a[@href="bar/index.html"]' 'bar'
//@ hasraw 'empty_mod_public/sidebar-items.js' 'bar'
//@ matches 'empty_mod_public/bar/index.html' '//h1' 'Module empty_mod_public::bar'
//@ matches 'empty_mod_public/bar/index.html' '//h1' 'Module bar'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_public::'
pub mod bar {
//@ has 'empty_mod_public/bar/index.html' '//a[@href="baz/index.html"]' 'baz'
//@ hasraw 'empty_mod_public/bar/sidebar-items.js' 'baz'
//@ matches 'empty_mod_public/bar/baz/index.html' '//h1' 'Module empty_mod_public::bar::baz'
//@ matches 'empty_mod_public/bar/baz/index.html' '//h1' 'Module baz'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_public::bar::'
pub mod baz {}
}

View file

@ -10,15 +10,19 @@ extern crate foo;
//@ has - '//a/[@href="struct.DeprecatedStepBy.html"]' "DeprecatedStepBy"
//@ has - '//a/[@href="struct.StepBy.html"]' "StepBy"
//@ has foo/iter/struct.DeprecatedStepBy.html
//@ has - '//h1' "Struct foo::iter::DeprecatedStepBy"
//@ has - '//h1' "Struct DeprecatedStepBy"
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::iter::'
//@ has foo/iter/struct.StepBy.html
//@ has - '//h1' "Struct foo::iter::StepBy"
//@ has - '//h1' "Struct StepBy"
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::iter::'
//@ has bar/iter/index.html
//@ has - '//a/[@href="struct.DeprecatedStepBy.html"]' "DeprecatedStepBy"
//@ has - '//a/[@href="struct.StepBy.html"]' "StepBy"
//@ has bar/iter/struct.DeprecatedStepBy.html
//@ has - '//h1' "Struct bar::iter::DeprecatedStepBy"
//@ has - '//h1' "Struct DeprecatedStepBy"
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'bar::iter::'
//@ has bar/iter/struct.StepBy.html
//@ has - '//h1' "Struct bar::iter::StepBy"
//@ has - '//h1' "Struct StepBy"
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'bar::iter::'
pub use foo::iter;

View file

@ -6,7 +6,6 @@
//@ has foo/index.html '//a[@href="keyword.match.html"]' 'match'
//@ has foo/index.html '//div[@class="sidebar-elems"]//li/a' 'Keywords'
//@ has foo/index.html '//div[@class="sidebar-elems"]//li/a/@href' '#keywords'
//@ has foo/keyword.match.html '//a[@class="keyword"]' 'match'
//@ has foo/keyword.match.html '//h1' 'Keyword match'
//@ has foo/keyword.match.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
//@ has foo/index.html '//a/@href' '../foo/index.html'

View file

@ -8,7 +8,6 @@
//@ has - '//div[@class="sidebar-elems"]//li/a' 'Primitive Types'
//@ has - '//div[@class="sidebar-elems"]//li/a/@href' '#primitives'
//@ has foo/primitive.reference.html
//@ has - '//a[@class="primitive"]' 'reference'
//@ has - '//h1' 'Primitive Type reference'
//@ has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'

View file

@ -3,8 +3,7 @@
#![crate_name = "foo"]
#![feature(rustc_attrs)]
//@ has foo/primitive.slice.html '//a[@class="primitive"]' 'slice'
//@ has - '//h1' 'Primitive Type slice'
//@ has foo/primitive.slice.html '//h1' 'Primitive Type slice'
//@ has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
//@ has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations'
//@ has - '//div[@id="synthetic-implementations-list"]//h3' 'impl<T> Send for [T]where T: Send'

View file

@ -3,8 +3,7 @@
#![crate_name = "foo"]
#![feature(rustc_attrs)]
//@ has foo/primitive.tuple.html '//a[@class="primitive"]' 'tuple'
//@ has - '//h1' 'Primitive Type tuple'
//@ has foo/primitive.tuple.html '//h1' 'Primitive Type tuple'
//@ has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
//@ has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations'
//@ has - '//div[@id="synthetic-implementations-list"]//h3' 'Send'

View file

@ -3,8 +3,7 @@
#![crate_name = "foo"]
#![feature(rustc_attrs)]
//@ has foo/primitive.unit.html '//a[@class="primitive"]' 'unit'
//@ has - '//h1' 'Primitive Type unit'
//@ has foo/primitive.unit.html '//h1' 'Primitive Type unit'
//@ has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
//@ has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations'
//@ has - '//div[@id="synthetic-implementations-list"]//h3' 'impl Send for ()'

View file

@ -5,53 +5,65 @@
//@ matches 'foo/index.html' '//div[@class="sidebar-crate"]/h2/a' 'foo'
//@ count 'foo/index.html' '//h2[@class="location"]' 0
//@ matches 'foo/foo_mod/index.html' '//h1' 'Module foo::foo_mod'
//@ matches 'foo/foo_mod/index.html' '//h2[@class="location"]' 'Module foo_mod'
//@ matches 'foo/foo_mod/index.html' '//h1' 'Module foo_mod'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//h2[@class="location"]' 'Module foo_mod'
pub mod foo_mod {
pub struct __Thing {}
}
extern "C" {
//@ matches 'foo/fn.foo_ffn.html' '//h1' 'Function foo::foo_ffn'
//@ matches 'foo/fn.foo_ffn.html' '//h1' 'Function foo_ffn'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
pub fn foo_ffn();
}
//@ matches 'foo/fn.foo_fn.html' '//h1' 'Function foo::foo_fn'
//@ matches 'foo/fn.foo_fn.html' '//h1' 'Function foo_fn'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
pub fn foo_fn() {}
//@ matches 'foo/trait.FooTrait.html' '//h1' 'Trait foo::FooTrait'
//@ matches 'foo/trait.FooTrait.html' '//h2[@class="location"]' 'FooTrait'
//@ matches 'foo/trait.FooTrait.html' '//h1' 'Trait FooTrait'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//h2[@class="location"]' 'FooTrait'
pub trait FooTrait {}
//@ matches 'foo/struct.FooStruct.html' '//h1' 'Struct foo::FooStruct'
//@ matches 'foo/struct.FooStruct.html' '//h2[@class="location"]' 'FooStruct'
//@ matches 'foo/struct.FooStruct.html' '//h1' 'Struct FooStruct'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//h2[@class="location"]' 'FooStruct'
pub struct FooStruct;
//@ matches 'foo/enum.FooEnum.html' '//h1' 'Enum foo::FooEnum'
//@ matches 'foo/enum.FooEnum.html' '//h2[@class="location"]' 'FooEnum'
//@ matches 'foo/enum.FooEnum.html' '//h1' 'Enum FooEnum'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//h2[@class="location"]' 'FooEnum'
pub enum FooEnum {}
//@ matches 'foo/type.FooType.html' '//h1' 'Type Alias foo::FooType'
//@ matches 'foo/type.FooType.html' '//h2[@class="location"]' 'FooType'
//@ matches 'foo/type.FooType.html' '//h1' 'Type Alias FooType'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//h2[@class="location"]' 'FooType'
pub type FooType = FooStruct;
//@ matches 'foo/macro.foo_macro.html' '//h1' 'Macro foo::foo_macro'
//@ matches 'foo/macro.foo_macro.html' '//h1' 'Macro foo_macro'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
#[macro_export]
macro_rules! foo_macro {
() => {};
}
//@ matches 'foo/primitive.bool.html' '//h1' 'Primitive Type bool'
//@ count - '//*[@class="rustdoc-breadcrumbs"]' 0
#[rustc_doc_primitive = "bool"]
mod bool {}
//@ matches 'foo/static.FOO_STATIC.html' '//h1' 'Static foo::FOO_STATIC'
//@ matches 'foo/static.FOO_STATIC.html' '//h1' 'Static FOO_STATIC'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
pub static FOO_STATIC: FooStruct = FooStruct;
extern "C" {
//@ matches 'foo/static.FOO_FSTATIC.html' '//h1' 'Static foo::FOO_FSTATIC'
//@ matches 'foo/static.FOO_FSTATIC.html' '//h1' 'Static FOO_FSTATIC'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
pub static FOO_FSTATIC: FooStruct;
}
//@ matches 'foo/constant.FOO_CONSTANT.html' '//h1' 'Constant foo::FOO_CONSTANT'
//@ matches 'foo/constant.FOO_CONSTANT.html' '//h1' 'Constant FOO_CONSTANT'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
pub const FOO_CONSTANT: FooStruct = FooStruct;