about summary refs log tree commit diff
path: root/src/librustdoc/html/render
AgeCommit message (Collapse)AuthorLines
2022-10-17Rollup merge of #103091 - notriddle:notriddle/sidebar-title, r=GuillaumeGomezMatthias Krüger-7/+1
rustdoc: remove unused HTML class `sidebar-title` Since 6a5f8b1aef1417d7dc85b5d0a229d2db1930eb7c, this class is no longer styled.
2022-10-15rustdoc: make the help button a link to a pageMichael Howell-0/+34
This allows you to open the help section in a new browser tab, which is a pretty reasonable thing to want for a documentation page.
2022-10-15rustdoc: remove unused HTML class `sidebar-title`Michael Howell-7/+1
Since 6a5f8b1aef1417d7dc85b5d0a229d2db1930eb7c, this class is no longer styled.
2022-10-10Remove outdated commentMichael Howell-1/+0
2022-10-10rustdoc: remove unneeded `<div>` wrapper from sidebar DOMMichael Howell-16/+7
When this was added, the sidebar had a bit more complex style. It can be removed, now.
2022-10-08rustdoc: remove weird `<a href="#">` wrapper around unsafe triangleMichael Howell-1/+1
This DOM cleanup changes the color of the triangle, from blue to black, but since it's still a different color from the link it's next to, it should still be noticeable.
2022-10-06rustdoc: remove unused HTML `class="item-list"`Michael Howell-4/+4
Since 50f662e99ec372a3c9558876d4164e8665859217, there is no CSS or JS targeting this class.
2022-10-05rustdoc: remove unused CSS class `in-band`Michael Howell-14/+4
Since a7c25b29575c17434406b69773f8c2961af343b3 removed `in-band` from code headers, the only remaining uses of the `in-band` class are: https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/write_shared.rs#L520-L521 https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/templates/print_item.html#L2-L3 https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/context.rs#L637-L638 https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/mod.rs#L368-L369 https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/mod.rs#L401-L402 https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/static/js/main.js#L525 Since all of these uses are nested below `h1.fqn`, we can get rid of it, and the support code that was used for when `in-band` was part of item rendering.
2022-09-30rustdoc: add missing margin to no-docblock trait itemsMichael Howell-2/+2
Fixes another regression caused by 8846c0853d8687fda0e5f23f6687b03b243980ee, this time fixing the appearance of methods that have no docblock (we didn't notice this one because libstd docs *always* have docblocks). See how it looks at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/trait.AttributesExt.html
2022-09-29Rollup merge of #102447 - notriddle:notriddle/method-toggle, r=jshaMichael Howell-1/+1
rustdoc: add method spacing to trait methods More cleanup for 8846c0853d8687fda0e5f23f6687b03b243980ee, this time in trait layouts when things are collapsed. This PR makes two changes to the appearance of trait pages: * It adds the `method-toggle` class to method toggles on traits, making the DOM more consistent with type pages (which already have this class). ## Before ![image](https://user-images.githubusercontent.com/1593513/192914353-ed17e1eb-df1d-480b-9998-3b5e8283b0ee.png) ## After ![image](https://user-images.githubusercontent.com/1593513/192914570-bdd0f2e1-5254-4e2e-9576-a797b82b3b3b.png) * It adds a bottom margin to docblocks nested directly in the implementors list, giving it a similar appearance to if it was nested within a toggle. ## Before ![image](https://user-images.githubusercontent.com/1593513/192914503-1c3f39d5-690f-44ec-8f11-385302477d04.png) ## After ![image](https://user-images.githubusercontent.com/1593513/192914702-cbce4b3b-5cc6-49dc-b7f8-73be9e76791c.png)
2022-09-28rustdoc: add method spacing to trait methodsMichael Howell-1/+1
More cleanup for 8846c0853d8687fda0e5f23f6687b03b243980ee, this time in trait layouts when things are collapsed.
2022-09-27rustdoc: remove `clean::TraitWithExtraInfo`Michael Howell-3/+8
Instead, it gathers the extra info later, when it's actually requested.
2022-09-25rustdoc: clean up `.out-of-band`/`.in-band` CSSMichael Howell-1/+1
* Remove the `float: right` fallback from the main header, which hasn't been needed since IE11 support was dropped. * Remove `in-band` from low-level headers, which hasn't been needed since `.rightside` switched to `float: right` in 593d6d1cb15c55c88319470dabb40126c7b7f1e2 * Remove unreachable `.in-band > code, .in-band > .code-header` CSS, since the `in-band` class was attached to the `code-header` itself, not nested directly below it. * Use `rem` instead of `em` for code header margins. * This results in a slight change in spacing around impls and item-info, but since it makes it more consistent with the way methods are presented, it's probably fine.
2022-09-23Rollup merge of #102158 - notriddle:notriddle/stab-p, r=GuillaumeGomezMatthias Krüger-9/+4
rustdoc: clean up CSS/DOM for deprecation warnings Preview: https://notriddle.com/notriddle-rustdoc-test/stab-p/std/macro.try.html
2022-09-22rustdoc: clean up CSS/DOM for deprecation warningsMichael Howell-9/+4
2022-09-22Improve some AllTypes fields nameGuillaume Gomez-10/+12
2022-09-22Rollup merge of #102054 - GuillaumeGomez:sidebar-all-page, r=notriddleYuki Okushi-44/+104
Unify "all items" page's sidebar with other pages Currently, the "all types" page's sidebar doesn't list the different categories of type available. This PR fixes it. Before: ![Screenshot from 2022-09-20 17-11-15](https://user-images.githubusercontent.com/3050060/191296348-95d8771d-a887-432e-96bd-d5284d87d743.png) After: ![Screenshot from 2022-09-20 17-11-09](https://user-images.githubusercontent.com/3050060/191296344-8e7318a3-eb51-4037-ae94-7ae2115363ce.png) r? `@notriddle`
2022-09-20Unify generation of section on "All items" page with all other pagesGuillaume Gomez-18/+18
2022-09-20Generate sidebar elements for the "All items" pageGuillaume Gomez-26/+86
2022-09-19rustdoc: remove `docblock` class from `item-decl`Michael Howell-15/+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-16rustdoc: clean up CSS for All Items and All Crates listsMichael Howell-20/+19
This reduces the amount of CSS, and makes these two pages more consistent (which, necessarily, means changing them a bit).
2022-09-15rustdoc: use more precise URLs for jump-to-definition linksMichael Howell-0/+30
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-05Auto merge of #101228 - nnethercote:simplify-hir-PathSegment, r=petrochenkovbors-18/+16
Simplify `hir::PathSegment` r? `@petrochenkov`
2022-09-05Rollup merge of #101391 - matthiaskrgr:perf0309, r=oli-obkDylan DPC-3/+3
more clippy::perf fixes
2022-09-05Make `hir::PathSegment::hir_id` non-optional.Nicholas Nethercote-18/+16
2022-09-03Rustdoc-Json: Add enum discriminantNixon Enraght-Moony-1/+2
2022-09-03more clippy::perf fixesMatthias Krüger-3/+3
2022-09-01Rollup merge of #101245 - GuillaumeGomez:remove-unneeded-where-whitespace, ↵Matthias Krüger-6/+6
r=notriddle Remove unneeded where whitespace It fixes these two bugs: ![Screenshot from 2022-08-31 18-14-40](https://user-images.githubusercontent.com/3050060/187727950-94657419-abfa-454c-9d27-004280fbcb45.png) ![Screenshot from 2022-08-31 18-14-49](https://user-images.githubusercontent.com/3050060/187727956-21d1b39d-62d7-4e7b-8f6f-631ceda67a19.png) It's a relic from a very old time (this commit: https://github.com/rust-lang/rust/commit/bfd01b7f40ae2cbfe9acbc1d10e79ffe16870df8). You can test the result [here](https://rustdoc.crud.net/imperio/remove-unneeded-where-whitespace/lib2/struct.WhereWhitespace.html). cc `````````@jsha````````` r? `````````@notriddle`````````
2022-08-31Remove unneeded extra whitespace before where clauseGuillaume Gomez-6/+6
2022-08-31Rollup merge of #101204 - aDotInTheVoid:async-resugar-in-clean, r=GuillaumeGomezRalf Jung-2/+2
rustdoc: Resugar async fn return type in `clean`, not `html` This way it also happens for json output. Fixes #101199 r? ``@GuillaumeGomez``
2022-08-31Print only blanket implementations on reference primitive typeGuillaume Gomez-67/+133
2022-08-30Clean up render_assoc_items_inner a bitGuillaume Gomez-54/+52
2022-08-30rustdoc: Resugar async fn return type in `clean`, not `html`Nixon Enraght-Moony-2/+2
This way it also happens for json output. Fixes #101199
2022-08-28Auto merge of #100497 - kadiwa4:remove_clone_into_iter, r=cjgillotbors-4/+9
Avoid cloning a collection only to iterate over it `@rustbot` label: +C-cleanup
2022-08-27Rollup merge of #101062 - notriddle:notriddle/text-javascript, r=GuillaumeGomezYuki Okushi-2/+4
rustdoc: remove empty extern_crates and type="text/javascript" on script Like #101023, this removes an attribute with a default value.
2022-08-27Rollup merge of #101018 - notriddle:notriddle/item-right-docblock-short, ↵Yuki Okushi-4/+14
r=GuillaumeGomez rustdoc: omit start/end tags for empty item description blocks Related to #100952 This is definitely not a complete solution, but it does shrink keysyms/index.html on smithay from 620K to 516K.
2022-08-26rustdoc: remove empty extern_crates and type="text/javascript" on scriptMichael Howell-2/+4
Like #101023, this removes an attribute with a default value.
2022-08-26Rollup merge of #101006 - GuillaumeGomez:doc-cfg-reexport, r=notriddleGuillaume Gomez-2/+9
Fix doc cfg on reexports Fixes #83428. The problem was that the newly inlined item cfg propagation was not working since its real parent is different than its current one. For the implementation, I decided to put it directly into `CfgPropagation` instead of inside `inline.rs` because I thought it would be simpler to maintain and to not forget if new kind of items are added if it's all done in one place. r? `@notriddle`
2022-08-25rustdoc: omit start/end tags for empty item description blocksMichael Howell-4/+14
Related to #100952 This is definitely not a complete solution, but it does shrink keysyms/index.html on smithay from 620K to 516K.
2022-08-25Fix missing cfg propagation for reexportsGuillaume Gomez-2/+9
2022-08-24Remove the extra DOM level if there is only one child in rightside elementsGuillaume Gomez-11/+34
2022-08-24Unify rightside renderingGuillaume Gomez-32/+12
2022-08-24Auto merge of #96869 - sunfishcode:main, r=joshtriplettbors-1/+1
Optimize `Wtf8Buf::into_string` for the case where it contains UTF-8. Add a `is_known_utf8` flag to `Wtf8Buf`, which tracks whether the string is known to contain UTF-8. This is efficiently computed in many common situations, such as when a `Wtf8Buf` is constructed from a `String` or `&str`, or with `Wtf8Buf::from_wide` which is already doing UTF-16 decoding and already checking for surrogates. This makes `OsString::into_string` O(1) rather than O(N) on Windows in common cases. And, it eliminates the need to scan through the string for surrogates in `Args::next` and `Vars::next`, because the strings are already being translated with `Wtf8Buf::from_wide`. Many things on Windows construct `OsString`s with `Wtf8Buf::from_wide`, such as `DirEntry::file_name` and `fs::read_link`, so with this patch, users of those functions can subsequently call `.into_string()` without paying for an extra scan through the string for surrogates. r? `@ghost`
2022-08-21Auto merge of #100645 - notriddle:notriddle/rustdoc-diet-plan, r=GuillaumeGomezbors-2/+2
rustdoc: strategic boxing to reduce the size of ItemKind and Type The `Type` change redesigns `QPath` to box the entire data structure instead of boxing `self_type` and the `trait_`. This reduces the size of several `ItemKind` variants, leaving `Impl` as the biggest variant. The `ItemKind` change boxes that variant's payload.
2022-08-20Rollup merge of #100718 - GuillaumeGomez:fix-item-info, r=jshaMatthias Krüger-4/+8
[rustdoc] Fix item info display Fixes #100369. The solution I came up with was simply to wrap the "text part" of the `item-info` into another span so that `flex` wouldn't mess with it. Live demo is [here](https://rustdoc.crud.net/imperio/fix-item-info/foo/struct.ItemInfo.html). r? ``@jsha``
2022-08-18rustdoc: count deref and non-deref as same set of used methodsMichael Howell-6/+11
2022-08-18Fix item-info displayGuillaume Gomez-4/+8
2022-08-16rustdoc: factor Type::QPath out into its own boxMichael Howell-2/+2
This reduces the size of Type.
2022-08-13make clean::Item::span return option instead of dummy spanMichael Goulet-5/+2
2022-08-13avoid cloning and then iteratingKaDiWa-4/+9