Skip to content

Commit 5e34b79

Browse files
authored
Rollup merge of #101335 - notriddle:notriddle/methods-stability, r=notriddle
rustdoc: remove old CSS selector that causes weird spacing It was added with e08a84a (actually, it was called `.methods > .stability` at the time) and was directly nested that way. **EDIT**: It is technically reachable code still, but it seems wrong. ## With the old CSS rule still present https://notriddle.com/notriddle-rustdoc-test/weird-spacing/lib/struct.Foo.html ![image](https://user-images.githubusercontent.com/1593513/188216226-c667c560-d33d-494f-a492-4e0ec3ac0009.png) ## Version 2 (an older version of this PR) https://notriddle.com/notriddle-rustdoc-test/normal-spacing-2/lib/struct.Foo.html ![image](https://user-images.githubusercontent.com/1593513/188216418-9fcd3109-f1b2-425d-b4fc-0c6b3b54e48e.png) ## Version 3 (with alignment fix for mobile) https://notriddle.com/notriddle-rustdoc-test/normal-spacing-3/lib/struct.Foo.html ![image](https://user-images.githubusercontent.com/1593513/188223161-0e1ebce7-842f-41cb-8a0c-ae43aedcfccc.png)
2 parents 06b72b0 + 0f29824 commit 5e34b79

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

src/librustdoc/html/static/css/rustdoc.css

+5-8
Original file line numberDiff line numberDiff line change
@@ -778,14 +778,6 @@ pre, .rustdoc.source .example-wrap {
778778
margin-bottom: .6em;
779779
}
780780

781-
.content .impl-items > .item-info {
782-
margin-left: 40px;
783-
}
784-
785-
.methods > .item-info, .content .impl-items > .item-info {
786-
margin-top: -8px;
787-
}
788-
789781
.impl-items {
790782
flex-basis: 100%;
791783
}
@@ -2035,6 +2027,11 @@ in storage.js plus the media query with (min-width: 701px)
20352027
#main-content > div > details.rustdoc-toggle > summary::before {
20362028
left: -11px;
20372029
}
2030+
2031+
/* Align summary-nested and unnested item-info gizmos. */
2032+
.content .impl-items > .item-info {
2033+
margin-left: 34px;
2034+
}
20382035
}
20392036

20402037
@media print {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This test ensures that the "item-info" looks about the same
2+
// whether or not it's inside a toggle.
3+
goto: file://|DOC_PATH|/lib2/struct.ItemInfoAlignmentTest.html
4+
5+
// First, we try it in "desktop" mode.
6+
size: (1200, 870)
7+
compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x"))
8+
// Next, we try it in "mobile" mode (max-width: 700px).
9+
size: (650, 650)
10+
compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x"))

src/test/rustdoc-gui/src/lib2/lib.rs

+10
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,13 @@ where
170170
type Output;
171171
fn index(&self, index: Idx) -> &Self::Output;
172172
}
173+
174+
pub struct ItemInfoAlignmentTest;
175+
176+
impl ItemInfoAlignmentTest {
177+
/// This method has docs
178+
#[deprecated]
179+
pub fn foo() {}
180+
#[deprecated]
181+
pub fn bar() {}
182+
}

0 commit comments

Comments
 (0)