Skip to content

Commit ea16128

Browse files
committed
Auto merge of #82947 - GuillaumeGomez:fix-nojs-style-issues, r=Nemo157
Fix nojs style issues There are two issues fixed here: 1. The position of "{version}" and "[src]" spans. 2. The position of attributes (on top of functions) Please note that these issues only happen if you have disabled javascript. Before: ![Screenshot from 2021-03-09 20-45-54](https://user-images.githubusercontent.com/3050060/110534652-9e048e00-811f-11eb-979e-6d85545edd65.png) After: ![Screenshot from 2021-03-09 21-01-32](https://user-images.githubusercontent.com/3050060/110534667-a1981500-811f-11eb-8a19-32f4d5381a2b.png) In the last commit, I added a test to enforce the attributes position. I need to think how to enforce it for the spans but that can comes later on. r? `@Nemo157`
2 parents 04fce73 + 40adb9a commit ea16128

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

src/librustdoc/html/static/noscript.css

+10
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,13 @@ rules.
2323
#main .impl-items .hidden {
2424
display: block !important;
2525
}
26+
27+
#main .impl-items h4.hidden {
28+
/* Without this rule, the version and the "[src]" span aren't on the same line as the header. */
29+
display: flex !important;
30+
}
31+
32+
#main .attributes {
33+
/* Since there is no toggle (the "[-]") when JS is disabled, no need for this margin either. */
34+
margin-left: 0 !important;
35+
}

src/librustdoc/html/static/rustdoc.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,7 @@ h4 > .notable-traits {
13431343
@media (min-width: 701px) {
13441344
/* In case there is no documentation before a code block, we need to add some margin at the top
13451345
to prevent an overlay between the "collapse toggle" and the information tooltip.
1346-
However, it's needed needed with smaller screen width because the doc/code block is always put
1346+
However, it's not needed with smaller screen width because the doc/code block is always put
13471347
"one line" below. */
13481348
.information:first-child > .tooltip {
13491349
margin-top: 16px;

src/test/rustdoc-gui/lib.rs

+5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ pub fn foo() {}
2727
/// Just a normal struct.
2828
pub struct Foo;
2929

30+
impl Foo {
31+
#[must_use]
32+
pub fn must_use(&self) -> bool { true }
33+
}
34+
3035
/// Just a normal enum.
3136
pub enum WhoLetTheDogOut {
3237
/// Woof!
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Check that the attributes are well positioned when javascript is disabled (since
2+
// there is no toggle to display)
3+
javascript: false
4+
goto: file://|DOC_PATH|/struct.Foo.html
5+
assert: (".attributes", {"margin-left": "0px"})

0 commit comments

Comments
 (0)