about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2022-09-21rustdoc: dynamically show-hide line numbers on code examplesMichael Howell-11/+37
2022-09-21rustdoc: use block flex for line-number CSSMichael Howell-5/+1
`display: inline-flex` was used as part of e961d397cab900c55f8d8c104648852e2b63664e, the original commit that added these line numbers. Does anyone know why it was done this way?
2022-09-21Add missing space between notable trait tooltip and where clauseUrgau-1/+1
2022-09-21Prevent usage of `.stab` elements to create scrollable areas in doc blocksGuillaume Gomez-0/+6
2022-09-20rustdoc: remove no-op `.method { position: relative }`Michael Howell-3/+0
This rule was added in 88fe6dfa31a1bee49090dc72c537c5cd7bd632f4 to assist in position the hide/show togges on methods. This is no longer needed, because these toggles are no longer implemented as absolutely positioned links nested inside headers.
2022-09-20rustdoc: remove no-op `.method { font-size: 1rem }`Michael Howell-1/+0
This rule was added in 22dad4b0440b184568956c10f2cbedabf763065a, back when the `method` class was attached to headers instead of DIVs that wrap headers. Old method rendering: https://github.com/rust-lang/rust/blob/a96247bcac385671757034bd928c13097fd2ce76/src/librustdoc/html/render.rs#L2062 Current method rendering: https://github.com/rust-lang/rust/blob/432abd86f231c908f6df3cdd779e83f35084be90/src/librustdoc/html/render/print_item.rs#L721
2022-09-20Unify generation of section on "All items" page with all other pagesGuillaume Gomez-18/+18
2022-09-20Rollup merge of #102034 - notriddle:notriddle/border-bottom, r=GuillaumeGomezMichael Howell-7/+0
rustdoc: remove no-op CSS `h1-6 { border-bottom-color }` For this rule to have an actual effect, the border-bottom width needs specified, elsewhere, without also specifying the color. This doesn't happen. Ever since 88b137d5fe0cbe28dab4f9af61045c726f831872, every spot where headers get a border assigned to them also assigns the color. Preview: https://notriddle.com/notriddle-rustdoc-test/border-bottom/rustc_monomorphize/collector/index.html
2022-09-20Rollup merge of #102027 - notriddle:notriddle/docblock-item-decl, ↵Michael Howell-18/+15
r=GuillaumeGomez rustdoc: remove `docblock` class from `item-decl` This class was originally added in 73b97c7e7c9cfac4dfa4804654b1db6ab687b589 to support hiding and showing the item, because `main.js` went through all `docblock` elements in the DOM and added toggles to them. https://github.com/rust-lang/rust/blob/73b97c7e7c9cfac4dfa4804654b1db6ab687b589/src/librustdoc/html/static/main.js#L1856-L1867 The `item-decl` is no longer auto-hidden since c96f86de3026f864e78397aff9097e885f2f8fdf removed it. `item-decl` used to be called `type-decl`: that name was changed in 8b7a2dd4626acf164e1ce8397878b3f5af83d585. The `docblock` class is no longer used for implementing toggles, since rustdoc switched to using `<details>` elements. Preview: https://notriddle.com/notriddle-rustdoc-test/docblock-item-decl/rustdoc/clean/types/enum.Type.html
2022-09-20Generate sidebar elements for the "All items" pageGuillaume Gomez-26/+86
2022-09-19rustdoc: remove no-op CSS `h1-6 { border-bottom-color }`Michael Howell-7/+0
For this rule to have an actual effect, the border-bottom width needs specified, elsewhere, without also specifying the color. This doesn't happen. Ever since 88b137d5fe0cbe28dab4f9af61045c726f831872, every spot where headers get a border assigned to them also assigns the color.
2022-09-19rustdoc: remove `docblock` class from `item-decl`Michael Howell-18/+15
This class was originally added in 73b97c7e7c9cfac4dfa4804654b1db6ab687b589 to support hiding and showing the item, because `main.js` went through all `docblock` elements in the DOM and added toggles to them. https://github.com/rust-lang/rust/blob/73b97c7e7c9cfac4dfa4804654b1db6ab687b589/src/librustdoc/html/static/main.js#L1856-L1867 The `item-decl` is no longer auto-hidden since c96f86de3026f864e78397aff9097e885f2f8fdf removed it. `item-decl` used to be called `type-decl`: that name was changed in 8b7a2dd4626acf164e1ce8397878b3f5af83d585. The `docblock` class is no longer used for implementing toggles, since rustdoc switched to using `<details>` elements.
2022-09-18rustdoc: remove unused CSS `td.summary-column`Michael Howell-4/+0
It was added in 2a1bad70dd9bc99d8db54964108b42da8f4e9fbd to go with this module summary function: https://github.com/rust-lang/rust/blob/2a1bad70dd9bc99d8db54964108b42da8f4e9fbd/src/librustdoc/html/format.rs#L767-L780 The corresponding HTML was removed in 0a46933c4d81573e78ce16cd215ba155a3114fce.
2022-09-18Rollup merge of #101954 - notriddle:notriddle/location-a-first-of-type, ↵Matthias Krüger-4/+0
r=GuillaumeGomez rustdoc: remove redundant `.location a { font-weight: 500 }` The `class="location"` element is an h2, either in the sidebar or in the mobile header. Either way, it already has `font-weight: 500`, which the link inside will inherit. The original version of this rule was added in 9e82fc7ef9b6c8a344dd27583990b02a661af78c. At that time, the location header was rendered as a paragraph with the full path: https://github.com/rust-lang/rust/blob/9e82fc7ef9b6c8a344dd27583990b02a661af78c/src/librustdoc/html/render.rs#L2080 Nowadays, it's rendered as a true header, with only the name of the item, and the full path is included in a separate `fqn` header: https://github.com/rust-lang/rust/blob/98ad6a5519651af36e246c0335c964dd52c554ba/src/librustdoc/html/render/mod.rs#L1797
2022-09-17rustdoc: remove redundant `.location a { font-weight: 500 }`Michael Howell-4/+0
The `class="location"` element is an h2, either in the sidebar or in the mobile header. Either way, it already has `font-weight: 500`, which the link inside will inherit. The original version of this rule was added in 9e82fc7ef9b6c8a344dd27583990b02a661af78c. At that time, the location header was rendered as a paragraph with the full path: https://github.com/rust-lang/rust/blob/9e82fc7ef9b6c8a344dd27583990b02a661af78c/src/librustdoc/html/render.rs#L2080 Nowadays, it's rendered as a true header, with only the name of the item, and the full path is included in a separate `fqn` header: https://github.com/rust-lang/rust/blob/98ad6a5519651af36e246c0335c964dd52c554ba/src/librustdoc/html/render/mod.rs#L1797
2022-09-17Auto merge of #101949 - matthiaskrgr:rollup-xu5cqnd, r=matthiaskrgrbors-4/+0
Rollup of 7 pull requests Successful merges: - #101093 (Initial version of 1.64 release notes) - #101713 (change AccessLevels representation) - #101821 (Bump Unicode to version 15.0.0, regenerate tables) - #101826 (Enforce "joined()" and "joined_with_noop()" test) - #101835 (Allow using vendoring when running bootstrap from outside the source root) - #101942 (Revert "Copy stage0 binaries into stage0-sysroot") - #101943 (rustdoc: remove unused CSS `.non-exhaustive { margin-bottom }`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-17Rollup merge of #101934 - GuillaumeGomez:theme-links-cleanup, r=notriddleMatthias Krüger-78/+67
Continue migration of CSS themes Now that https://github.com/rust-lang/rust/pull/101898 has been merged, we can move forward. This PR moves more CSS theme rules as CSS variables. I also added a GUI test to prevent regressions. Part of https://github.com/rust-lang/rust/pull/98460. r? ``@notriddle``
2022-09-17Rollup merge of #101918 - notriddle:notriddle/all, r=GuillaumeGomezMatthias Krüger-26/+22
rustdoc: clean up CSS for All Items and All Crates lists This reduces the amount of CSS, and makes these two pages more consistent (which, necessarily, means changing them a bit). # Before ![image](https://user-images.githubusercontent.com/1593513/190735035-c66b2664-3783-483c-9bc6-89f80e4a5490.png) ![image](https://user-images.githubusercontent.com/1593513/190735134-1d5df81d-58c5-4c86-b066-6dd3031ffc2e.png) # After ![image](https://user-images.githubusercontent.com/1593513/190735261-fc3878bb-0cab-4c4e-a6da-b5f7abd06588.png) ![image](https://user-images.githubusercontent.com/1593513/190735389-935a7836-f2c0-4349-a7d0-7fe5378f6b9a.png)
2022-09-17rustdoc: remove unused CSS `.non-exhaustive { margin-bottom }`Michael Howell-4/+0
This selector was added in 959a13d53e27ca92b59798e6c6737f8249d59a2e to target a `<div class="non-exhaustive">`. With 4edcf6147912e7e4c1f13208d830c3c25e544a8c, the non-exhaustive indicator was changed to a `<details>`, and a separate selector targetting `details.non-exhaustive` was added for it, but the old selector was never removed.
2022-09-16Rollup merge of #101911 - notriddle:notriddle/source-content, r=GuillaumeGomezMichael Howell-2/+0
rustdoc: remove no-op CSS on `.source .content` # `margin-left: 0` This rule originated in 7669f04fb0ddc3d71a1fb44dc1c5c00a6564ae99, to override the default, massive left margin that content used to accommodate the sidebar: https://github.com/rust-lang/rust/blob/7669f04fb0ddc3d71a1fb44dc1c5c00a6564ae99/src/librustdoc/html/static/main.css#L307-L309 This massive left margin doesn't exist any more. It was replaced with a flexbox-based sidebar layout in 135281ed1525db15edd8ebd092aa10aa40df2386. # `max-width: none` This rule originated in 7669f04fb0ddc3d71a1fb44dc1c5c00a6564ae99, to override the default, limited line-width that makes sense for prose, but doesn't make sense for code (which typically uses hard-wrapped lines): https://github.com/rust-lang/rust/blob/7669f04fb0ddc3d71a1fb44dc1c5c00a6564ae99/src/librustdoc/html/static/main.css#L153 This line width limiter isn't applied to the `<div class="content">` node any more. It's been moved to a separate wrapper `<div>` that used to be called `main-inner` (in 135281ed1525db15edd8ebd092aa10aa40df2386) but is now called `width-limiter` (since d7528e2157762fadb9665518fd1e4dee6d6a2809).
2022-09-16Rollup merge of #101898 - GuillaumeGomez:rm-unused-css, r=notriddleMichael Howell-105/+46
Remove some unused CSS rules Since we now have list of items for the ones on the page, we don't need the CSS rules anymore in the sidebar (`.sidebar a`). As for the `.content` ones, they are used to highlight the items in the page (for definitions and others). Surprisingly enough, `method` and `tymethod` are all replaced with `fnname`. I also used this opportunity to remove these rules in `ayu.css`: ```css .stab.unstable {} h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) {} ``` In the second commit, I removed the `.block a.current*` CSS rules as they're overridden by `.sidebar a.current*` CSS rules. In the third commit I removed unneeded empty rules (that were there to satisfy the `--check-theme` option). cc ``@jsha`` r? ``@notriddle``
2022-09-16rustdoc: clean up CSS for All Items and All Crates listsMichael Howell-26/+22
This reduces the amount of CSS, and makes these two pages more consistent (which, necessarily, means changing them a bit).
2022-09-16rustdoc: remove no-op CSS `.source .content { max-width: none }`Michael Howell-1/+0
This rule originated in 7669f04fb0ddc3d71a1fb44dc1c5c00a6564ae99, to override the default, limited line-width that makes sense for prose, but doesn't make sense for code (which typically uses hard-wrapped lines): https://github.com/rust-lang/rust/blob/7669f04fb0ddc3d71a1fb44dc1c5c00a6564ae99/src/librustdoc/html/static/main.css#L153 This line width limiter isn't applied to the `<div class="content">` node any more. It's been moved to a separate wrapper `<div>` that used to be called `main-inner` (in 135281ed1525db15edd8ebd092aa10aa40df2386) but is now called `width-limiter` (since d7528e2157762fadb9665518fd1e4dee6d6a2809).
2022-09-16rustdoc: remove no-op CSS `.source .content { margin-left: 0 }`Michael Howell-1/+0
This rule originated in 7669f04fb0ddc3d71a1fb44dc1c5c00a6564ae99, to override the default, massive left margin that content used to accommodate the sidebar: https://github.com/rust-lang/rust/blob/7669f04fb0ddc3d71a1fb44dc1c5c00a6564ae99/src/librustdoc/html/static/main.css#L307-L309 This massive left margin doesn't exist any more. It was replaced with a flexbox-based sidebar layout in 135281ed1525db15edd8ebd092aa10aa40df2386.
2022-09-16Create new CSS variables for links colorGuillaume Gomez-78/+67
2022-09-16Remove unneeded empty ayu CSS rulesGuillaume Gomez-21/+3
2022-09-16Remove unused `.block a.current*` rulesGuillaume Gomez-48/+51
2022-09-16Remove some unused CSS rulesGuillaume Gomez-62/+18
2022-09-16Rollup merge of #101877 - notriddle:notriddle/block, r=Dylan-DPCGuillaume Gomez-3/+0
rustdoc: remove no-op CSS `.block { padding: 0 }` This rule was changed in 8fb1250aba8135679463351a3813c04ae45bf311 from the original version that had a non-zero padding. It's not needed, because it's not overriding anything that would've given `.block` a padding.
2022-09-16Rollup merge of #101868 - ↵Guillaume Gomez-4/+39
notriddle:notriddle/short-links-jump-to-definition, r=GuillaumeGomez rustdoc: use more precise URLs for jump-to-definition links As an example, this cuts down <https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_middle/ty/mod.rs.html> by about 11%. $ du -h new_mod.rs.html old_mod.rs.html 296K new_mod.rs.html 332K old_mod.rs.html Like https://github.com/rust-lang/rust/pull/83237, but separate code since source links have a different URL structure. Related to [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/RFC.20for.20.22jump.20to.20definition.22.20feature/near/299029786) and [the jump-to-definition pre-RFC](https://github.com/GuillaumeGomez/rfcs/pull/1).
2022-09-16Rollup merge of #101494 - jsha:notable-traits-right, r=GuillaumeGomezGuillaume Gomez-6/+0
rustdoc mobile: move notable traits to return type These were originally on the left, but were moved to the return type in c90fb7185a5febb00b7f8ccb49abceacd41bad6e. The CSS rule for mobile did not get updated at the time, so updating it now. r? `@notriddle`
2022-09-15rustdoc: remove no-op CSS `.block { padding: 0 }`Michael Howell-3/+0
This rule was changed in 8fb1250aba8135679463351a3813c04ae45bf311 from the original version that had a non-zero padding. It's not needed, because it's not overriding anything that would've given `.block` a padding.
2022-09-15rustdoc: use more precise URLs for jump-to-definition linksMichael Howell-4/+39
As an example, this cuts down <https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_middle/ty/mod.rs.html> by about 11%. $ du -h new_mod.rs.html old_mod.rs.html 296K new_mod.rs.html 332K old_mod.rs.html
2022-09-15rustdoc: remove no-op CSS `h1-4 { color: --main-color }`Michael Howell-1/+0
Headers already inherit the font color they need from their parents. This rule dates back to earlier versions of the rustdoc theme, where headers and body had different text colors. https://github.com/rust-lang/rust/blob/68c15be8b5a28297ae58ea030adf49f265e41127/src/librustdoc/html/static/main.css#L72-L98 Nowadays, since the two have exactly the same color (specified by the `--main-color` variable), this rule does nothing.
2022-09-15Rollup merge of #101820 - notriddle:notriddle/a, r=GuillaumeGomezMatthias Krüger-1/+0
rustdoc: remove no-op rule `a { background: transparent }` The background is transparent by default. It was added in 5a01dbe67b43660bf1df96074f34a635aad50e56 to work around a bug in the JavaScript syntax highlighting engine that rustdoc used at the time.
2022-09-15Rollup merge of #101812 - notriddle:notriddle/titles-button, r=GuillaumeGomezMatthias Krüger-23/+6
rustdoc: clean up CSS `#titles` using flexbox This commit allows it to stop manually specifying pixel heights for the tabs on search result pages. There's less messing with manual breakpoints and less complex CSS selectors. # Before ![image](https://user-images.githubusercontent.com/1593513/190215034-253c0f58-07c6-41c9-8848-0442c0522070.png) # After ![image](https://user-images.githubusercontent.com/1593513/190215065-d2453dca-edf0-4353-8fc8-3a3b31f03892.png)
2022-09-15Rollup merge of #101778 - notriddle:notriddle/docblock-short-p, r=GuillaumeGomezMatthias Krüger-6/+6
rustdoc: clean up DOM by removing `.dockblock-short p` On https://doc.rust-lang.org/nightly/std/ this reduces the number out of `document.querySelectorAll("*").length` from 1278 to 1103. Preview: https://notriddle.com/notriddle-rustdoc-test/docblock-short-p/std/index.html
2022-09-14rustdoc: remove no-op rule `a { background: transparent }`Michael Howell-1/+0
The background is transparent by default. It was added in 5a01dbe67b43660bf1df96074f34a635aad50e56 to work around a bug in the JavaScript syntax highlighting engine that rustdoc used at the time.
2022-09-14rustdoc: clean up CSS `#titles` using flexboxMichael Howell-23/+6
This commit allows it to stop manually specifying pixel heights for the tabs on search result pages. There's less messing with manual breakpoints and less complex CSS selectors.
2022-09-14Rollup merge of #101773 - notriddle:notriddle/content-table, r=GuillaumeGomezDylan DPC-9/+1
rustdoc: remove outdated CSS `.content table` etc # Screenshot before ![image](https://user-images.githubusercontent.com/1593513/189992665-238aab28-d224-4466-901c-6e35e79182fb.png) # Screenshot after ![image](https://user-images.githubusercontent.com/1593513/189992762-35c8efe4-e980-40bd-b72c-3ae4cfd6f830.png) # Description The `.content table` / `.content td` / `.content tr` family of selectors date back to 4fd061c426902b0904c65e64a3780b21f9ab3afb, when module indexes and other parts of rustdoc used `<table>` tags for layout and content presentation. The `.content td h1, .content td h2` has only been changed since then to tweak the font size in dd5ff428edbc7cd4fa600b81f27bbec28589704f. https://github.com/rust-lang/rust/blob/4fd061c426902b0904c65e64a3780b21f9ab3afb/src/rustdoc_ng/html/static/main.css#L155-L162 This CSS would have affected: * search result tables, which were removed in b615c0c85469c94041a5e68b9d8b68dcf799f9f1 * module item tables, which were removed in 6020c79ddeafe8d9760b27c14c39da81bac9b4a6 * docblock tables from markdown, which still exist It may also have affected a few other tables over the last decade, but they've been gradually replaced with grid layouts and flexbox to make layouts that work better on narrow viewports. For example, 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9. These rules have no affect on the appearance of docblock tables --------------------------------------------------------------- .content table { border-spacing: 0 5px; } According to MDN, [border-spacing] only has an effect when `border-collapse` is `separate`. However, `border-collapse: collapse` is set globally for all tables, so this rule does nothing. [border-spacing]: https://developer.mozilla.org/en-US/docs/Web/CSS/border-spacing .content td p:first-child { margin-top: 0; } Tables with paragraphs in them are impossible without dropping down to raw HTML. Also, the rustdoc stylesheet sets paragraphs to have no top margin anyway, so this rule is a no-op. .content td h1, .content td h2 { margin-left: 0; font-size: 1.125rem; } Tables with headers in them are impossible without dropping down to raw HTML. This is considered unlikely, especially since it looks weird right now (`.docblock h2` has an underline that is redundant with the table cell's own border). .content tr:first-child td { border-top: 0; } This has no effect because of border collapsing. This rule is removed, because tables look fine without it --------------------------------------------------------- .content td:first-child { padding-right: 20px; } By removing this rule, the first cell in each row has the same padding as all other cells in the row. This rule is kept, and converted to directly target `.docblock` --------------------------------------------------------------- .content td { vertical-align: top; } Removing this rule would cause it to be aligned to the middle instead.
2022-09-14Rollup merge of #101769 - notriddle:notriddle/out-of-band-span-since, ↵Dylan DPC-1/+0
r=GuillaumeGomez rustdoc: remove redundant CSS `.out-of-band > span.since { position }` At the time this CSS was added, it was just `span.since`, because the version info could be rendered in two different ways: 1. `<div class='since'>` was used for associated items like methods. It was absolutely positioned, and the selector in rustdoc.css that targetted it was just `.since`. https://github.com/rust-lang/rust/blob/a5a2f2b951ea982a666eaf52b1874d8f1b17290b/src/librustdoc/html/static/rustdoc.css#L522-L529 2. `<span class='since'>` was introduced in a5a2f2b951ea982a666eaf52b1874d8f1b17290b for page-global version info, so that it could be laid out alongside the `[-]`/`[+]` button. This CSS rule was added to override the absolute position introduced in (1). https://github.com/rust-lang/rust/blob/a5a2f2b951ea982a666eaf52b1874d8f1b17290b/src/librustdoc/html/static/rustdoc.css#L637-L641 The selector was changed in 8fc6e420d16dc882f2047e6ec1b981cac5ef0d14 so that everything could use a `<span>` tag, but the dichotomy of the absolutely-positioned version info for associated items and the static positioned item version info remained. The absolutely positioned `.since` was changed to one nested below a `<div class="rightside">` container in 5de1391b88007a1d4f7b1517657a86aae352af1e, so the version information is now always statically-positioned, and, as described in the commit message, "their DOM representation is consistent."
2022-09-13rustdoc: clean up DOM by removing `.dockblock-short p`Michael Howell-6/+6
On https://doc.rust-lang.org/nightly/std/ this reduces the number out of `document.querySelectorAll("*").length` from 1278 to 1103.
2022-09-13Rollup merge of #101737 - ↵Matthias Krüger-6/+0
notriddle:notriddle/search-results-result-name-span, r=GuillaumeGomez rustdoc: remove no-op CSS `.search-results .result-name > span` The rule `display: inline-block` was added in 5afa52bc7dee683f25f437dddf338dbc6ad32eb8. The `margin: 0` and `font-weight: normal` were added in c01bd560e2f87a9a960ed071213edd70f73171a8. Both seem to have been added to override class-based rules that were targetted at method sections. See <https://github.com/rust-lang/rust/blob/c01bd560e2f87a9a960ed071213edd70f73171a8/src/librustdoc/html/static/rustdoc.css#L140-L148> for an example. The selectors that these were meant to override were changed in a8318e420d19c364b1eec33956a86164941f6df4 and 76a3b609d0b93c5d8da5e4e3db37bd03e5cb1c30 to be more specific, so they no longer need to be overridden.
2022-09-13rustdoc: remove outdated CSS `.content table` etcMichael Howell-9/+1
The `.content table` / `.content td` / `.content tr` family of selectors date back to 4fd061c426902b0904c65e64a3780b21f9ab3afb, when module indexes and other parts of rustdoc used `<table>` tags for layout and content presentation. The `.content td h1, .content td h2` has only been changed since then to tweak the font size in dd5ff428edbc7cd4fa600b81f27bbec28589704f. https://github.com/rust-lang/rust/blob/4fd061c426902b0904c65e64a3780b21f9ab3afb/src/rustdoc_ng/html/static/main.css#L155-L162 This CSS would have affected: * search result tables, which were removed in b615c0c85469c94041a5e68b9d8b68dcf799f9f1 * module item tables, which were removed in 6020c79ddeafe8d9760b27c14c39da81bac9b4a6 * docblock tables from markdown, which still exist It may also have affected a few other tables over the last decade, but they've been gradually replaced with grid layouts and flexbox to make layouts that work better on narrow viewports. For example, 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9. These rules have no affect on the appearance of docblock tables =============================================================== .content table { border-spacing: 0 5px; } According to MDN, [border-spacing] only has an effect when `border-collapse` is `separate`. However, `border-collapse: collapse` is set globally for all tables, so this rule does nothing. [border-spacing]: https://developer.mozilla.org/en-US/docs/Web/CSS/border-spacing .content td p:first-child { margin-top: 0; } Tables with paragraphs in them are impossible without dropping down to raw HTML. Also, the rustdoc stylesheet sets paragraphs to have no top margin anyway, so this rule is a no-op. .content td h1, .content td h2 { margin-left: 0; font-size: 1.125rem; } Tables with headers in them are impossible without dropping down to raw HTML. This is considered unlikely, especially since it looks weird right now (`.docblock h2` has an underline that is redundant with the table cell's own border). .content tr:first-child td { border-top: 0; } This has no effect because of border collapsing. This rule is removed, because tables look fine without it ========================================================= .content td:first-child { padding-right: 20px; } By removing this rule, the first cell in each row has the same padding as all other cells in the row. This rule is kept, and converted to directly target `.docblock` =============================================================== .content td { vertical-align: top; } Removing this rule would cause it to be aligned to the middle instead.
2022-09-13rustdoc: remove redundant CSS `.out-of-band > span.since { position }`Michael Howell-1/+0
At the time this CSS was added, it was just `span.since`, because the version info could be rendered in two different ways: 1. `<div class='since'>` was used for associated items like methods. It was absolutely positioned, and the selector in rustdoc.css that targetted it was just `.since`. https://github.com/rust-lang/rust/blob/a5a2f2b951ea982a666eaf52b1874d8f1b17290b/src/librustdoc/html/static/rustdoc.css#L522-L529 2. `<span class='since'>` was introduced in a5a2f2b951ea982a666eaf52b1874d8f1b17290b for page-global version info, so that it could be laid out alongside the `[-]`/`[+]` button. This CSS rule was added to override the absolute position introduced in (1). https://github.com/rust-lang/rust/blob/a5a2f2b951ea982a666eaf52b1874d8f1b17290b/src/librustdoc/html/static/rustdoc.css#L637-L641 The selector was changed in 8fc6e420d16dc882f2047e6ec1b981cac5ef0d14 so that everything could use a `<span>` tag, but the dichotomy of the absolutely-positioned version info for associated items and the static positioned item version info remained. The absolutely positioned `.since` was changed to one nested below a `<div class="rightside">` container in 5de1391b88007a1d4f7b1517657a86aae352af1e, so the version information is now always statically-positioned, and, as described in the commit message, "their DOM representation is consistent."
2022-09-13Rollup merge of #101748 - notriddle:notriddle/source-sidebar-sidebar-toggle, ↵Dylan DPC-1/+0
r=GuillaumeGomez rustdoc: remove redundant CSS `#source-sidebar, #sidebar-toggle` These two elements are always nested below `<nav class="sidebar">`, and will inherit the font from their parent. These selectors were added in 93520d2ad145b791b1b1a6c71cdea65b1943ffb6, and became redundant in 07e3f998b1ceb4b8d2a7992782e60f5e776aa114 when the source sidebar elements became nested below `nav.sidebar`.
2022-09-13Rollup merge of #101690 - kadiwa4:avoid_iterator_last, r=oli-obkDylan DPC-2/+2
Avoid `Iterator::last` Adapters like `Filter` and `Map` use the default implementation of `Iterator::last` which is not short-circuiting (and so does `core::str::Split`). The predicate function will be run for every single item of the underlying iterator. I hope that removing those calls to `last` results in slight performance improvements.
2022-09-12rustdoc: remove redundant CSS `#source-sidebar, #sidebar-toggle`Michael Howell-1/+0
These two elements are always nested below `<nav class="sidebar">`, and will inherit the font from their parent. These selectors were added in 93520d2ad145b791b1b1a6c71cdea65b1943ffb6, and became redundant in 07e3f998b1ceb4b8d2a7992782e60f5e776aa114 when the source sidebar elements became nested below `nav.sidebar`.
2022-09-12rustdoc: remove no-op CSS `.search-results .result-name > span`Michael Howell-6/+0
The rule `display: inline-block` was added in 5afa52bc7dee683f25f437dddf338dbc6ad32eb8. The `margin: 0` and `font-weight: normal` were added in c01bd560e2f87a9a960ed071213edd70f73171a8. Both seem to have been added to override class-based rules that were targetted at method sections. See <https://github.com/rust-lang/rust/blob/c01bd560e2f87a9a960ed071213edd70f73171a8/src/librustdoc/html/static/rustdoc.css#L140-L148> for an example. The selectors that these were meant to override were changed in a8318e420d19c364b1eec33956a86164941f6df4 and 76a3b609d0b93c5d8da5e4e3db37bd03e5cb1c30 to be more specific, so they no longer need to be overridden.
2022-09-11rustdoc: remove no-op `#search`Michael Howell-4/+0
The padding rule was added in 135281ed1525db15edd8ebd092aa10aa40df2386 when converting the rule for #main, but didn't do anything even then.