From 3d9aceb2381e6c8c7066f7477bf407d00239e07c Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 9 Mar 2021 21:02:56 +0100 Subject: [PATCH 1/3] Fix CSS issues when javascript is disabled --- src/librustdoc/html/static/noscript.css | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/librustdoc/html/static/noscript.css b/src/librustdoc/html/static/noscript.css index ffa1a7639abbb..c9fed989ec04a 100644 --- a/src/librustdoc/html/static/noscript.css +++ b/src/librustdoc/html/static/noscript.css @@ -23,3 +23,13 @@ rules. #main .impl-items .hidden { display: block !important; } + +#main .impl-items h4.hidden { + /* Without this rule, the version and the "[src]" span aren't on the same line as the header. */ + display: flex !important; +} + +#main .attributes { + /* Since there is no toggle (the "[-]") when JS is disabled, no need for this margin either. */ + margin-left: 0 !important; +} From 09cb84048bc354a2abadc852399c19a4fbce14d8 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 9 Mar 2021 21:14:43 +0100 Subject: [PATCH 2/3] Fix typo --- src/librustdoc/html/static/rustdoc.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 94c231cb33a8b..996e0f95d0885 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -1343,7 +1343,7 @@ h4 > .notable-traits { @media (min-width: 701px) { /* In case there is no documentation before a code block, we need to add some margin at the top to prevent an overlay between the "collapse toggle" and the information tooltip. - However, it's needed needed with smaller screen width because the doc/code block is always put + However, it's not needed with smaller screen width because the doc/code block is always put "one line" below. */ .information:first-child > .tooltip { margin-top: 16px; From 40adb9aeab84f1d1e757af838a4210f6e7b57292 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 9 Mar 2021 21:33:39 +0100 Subject: [PATCH 3/3] Add test to ensure the attributes position when js is disabled --- src/test/rustdoc-gui/lib.rs | 5 +++++ src/test/rustdoc-gui/nojs-attr-pos.goml | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 src/test/rustdoc-gui/nojs-attr-pos.goml diff --git a/src/test/rustdoc-gui/lib.rs b/src/test/rustdoc-gui/lib.rs index 3c996f5b65c92..15d8dcc6e8444 100644 --- a/src/test/rustdoc-gui/lib.rs +++ b/src/test/rustdoc-gui/lib.rs @@ -27,6 +27,11 @@ pub fn foo() {} /// Just a normal struct. pub struct Foo; +impl Foo { + #[must_use] + pub fn must_use(&self) -> bool { true } +} + /// Just a normal enum. pub enum WhoLetTheDogOut { /// Woof! diff --git a/src/test/rustdoc-gui/nojs-attr-pos.goml b/src/test/rustdoc-gui/nojs-attr-pos.goml new file mode 100644 index 0000000000000..35daa4cb9e322 --- /dev/null +++ b/src/test/rustdoc-gui/nojs-attr-pos.goml @@ -0,0 +1,5 @@ +// Check that the attributes are well positioned when javascript is disabled (since +// there is no toggle to display) +javascript: false +goto: file://|DOC_PATH|/struct.Foo.html +assert: (".attributes", {"margin-left": "0px"})