Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b676f55
rustdoc: add ways of collapsing all impl blocks
lolbinarycat May 27, 2025
978e11b
Upgrade the `fortanix-sgx-abi` dependency
tgross35 Jul 1, 2025
69b9bae
Guarantee 8 bytes of alignment in Thread::into_raw
orlp Jul 12, 2025
6f4d0bd
Tidy
orlp Jul 12, 2025
1d0eddb
tests: debuginfo: Work around or disable broken tests on powerpc
Gelbpunkt Jul 18, 2025
e1b6cfe
Rephrase comment to include some tracking issues
Gelbpunkt Jul 21, 2025
b8d628c
Use LocalKey<Cell> methods more
camsteffen Jul 22, 2025
e958b20
Fix unused_parens false positive
benschulz Jul 9, 2025
6fc68c1
Add test case for single bound
benschulz Jul 10, 2025
307f664
Replace unwrap_or with explicit match
benschulz Jul 24, 2025
730d33d
`loop_match`: suggest extracting to a `const` item
folkertdev Jul 7, 2025
1f4561b
Don't lint against named labels in `naked_asm!`
Amanieu May 9, 2025
53018dc
Disable has_reliable_f128_math on musl targets
Gelbpunkt Jul 25, 2025
33ed3fc
Rollup merge of #140871 - Amanieu:naked-asm-label, r=compiler-errors
tgross35 Jul 26, 2025
7abb4e2
Rollup merge of #141663 - lolbinarycat:rustdoc-collapse-impl-134429, …
tgross35 Jul 26, 2025
3b99668
Rollup merge of #143272 - tgross35:bump-fortanix, r=jhpratt,jethrogb
tgross35 Jul 26, 2025
d8f4ceb
Rollup merge of #143585 - folkertdev:loop-match-suggest-const-block, …
tgross35 Jul 26, 2025
75ed6de
Rollup merge of #143698 - benschulz:unused-parens-2, r=lcnr,compiler-…
tgross35 Jul 26, 2025
2fcea9f
Rollup merge of #143859 - orlp:thread-into-raw-align, r=jhpratt
tgross35 Jul 26, 2025
0f557ab
Rollup merge of #144160 - Gelbpunkt:debuginfo-tests-ppc, r=oli-obk
tgross35 Jul 26, 2025
bfacbf2
Rollup merge of #144412 - camsteffen:localkey-cell-refactors, r=petro…
tgross35 Jul 26, 2025
39141d0
Rollup merge of #144431 - Gelbpunkt:f128-math-musl, r=petrochenkov,tg…
tgross35 Jul 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
rustdoc: add ways of collapsing all impl blocks
either shift+click the Summary button,
or use the `_` key.

this collapses everything,
including (inherent) impl blocks.

no need for a special "expand all impl blocks"
method, as impl blocks are expanded during regular
"expand all".
doing "expand all" -> "collapse all" will always
result in only impl blocks being expaned.

some of the html is split up a bit awkwardly to
try to avoid introducing new whitespaces nodes,
which could affect display.

Co-authored-by: Guillaume Gomez <[email protected]>
  • Loading branch information
lolbinarycat and GuillaumeGomez committed Jun 16, 2025
commit b676f551e2b784c3ee7500edfc24fa46fdf6b6ef
24 changes: 19 additions & 5 deletions src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,11 @@ function preLoadCss(cssUrl) {
break;
case "-":
ev.preventDefault();
collapseAllDocs();
collapseAllDocs(false);
break;
case "_":
ev.preventDefault();
collapseAllDocs(true);
break;

case "?":
Expand Down Expand Up @@ -1038,11 +1042,14 @@ function preLoadCss(cssUrl) {
innerToggle.children[0].innerText = "Summary";
}

function collapseAllDocs() {
/**
* @param {boolean} collapseImpls - also collapse impl blocks if set to true
*/
function collapseAllDocs(collapseImpls) {
const innerToggle = document.getElementById(toggleAllDocsId);
addClass(innerToggle, "will-expand");
onEachLazy(document.getElementsByClassName("toggle"), e => {
if (e.parentNode.id !== "implementations-list" ||
if ((collapseImpls || e.parentNode.id !== "implementations-list") ||
(!hasClass(e, "implementors-toggle") &&
!hasClass(e, "type-contents-toggle"))
) {
Expand All @@ -1053,15 +1060,18 @@ function preLoadCss(cssUrl) {
innerToggle.children[0].innerText = "Show all";
}

function toggleAllDocs() {
/**
* @param {MouseEvent=} ev
*/
function toggleAllDocs(ev) {
const innerToggle = document.getElementById(toggleAllDocsId);
if (!innerToggle) {
return;
}
if (hasClass(innerToggle, "will-expand")) {
expandAllDocs();
} else {
collapseAllDocs();
collapseAllDocs(ev !== undefined && ev.shiftKey);
}
}

Expand Down Expand Up @@ -1519,6 +1529,10 @@ function preLoadCss(cssUrl) {
["&#9166;", "Go to active search result"],
["+", "Expand all sections"],
["-", "Collapse all sections"],
// for the sake of brevity, we don't say "inherint impl blocks",
// although that would be more correct,
// since trait impl blocks are collapsed by -
["_", "Collapse all sections, including impl blocks"],
].map(x => "<dt>" +
x[0].split(" ")
.map((y, index) => ((index & 1) === 0 ? "<kbd>" + y + "</kbd>" : " " + y + " "))
Expand Down
4 changes: 3 additions & 1 deletion src/librustdoc/html/static/js/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,9 @@ class RustdocToolbarElement extends HTMLElement {
<div id="help-button" tabindex="-1">
<a href="${rootPath}help.html"><span class="label">Help</span></a>
</div>
<button id="toggle-all-docs"><span class="label">Summary</span></button>`;
<button id="toggle-all-docs"
title="Collapse sections (shift-click to also collapse impl blocks)"><span
class="label">Summary</span></button>`;
}
}
window.customElements.define("rustdoc-toolbar", RustdocToolbarElement);
Loading