Skip to content

Rollup of 9 pull requests #103322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Oct 20, 2022
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0b27164
fix `SelfVisitor::is_self_ty` ICE
TaKO8Ki Oct 19, 2022
cf13d91
Clarify `run_in_thread_pool_with_globals`.
nnethercote Oct 9, 2022
5d716fd
Add a comment to `Compiler`.
nnethercote Oct 11, 2022
a3ccb19
Fixed docs typo in `library/std/src/time.rs`
johnmatthiggins Oct 20, 2022
9a9e2fe
check if impl_self is `Some`
TaKO8Ki Oct 20, 2022
afd0817
Adjust `transmute{,_copy}` to be clearer about which of `T` and `U` i…
thomcc Oct 20, 2022
d3c37b1
+/- shortcut now only expand/collapse, not both
GuillaumeGomez Oct 20, 2022
8e3b891
Add GUI tests for collapse/expand actions
GuillaumeGomez Oct 20, 2022
ed1f02b
fix typo
cuishuang Oct 20, 2022
47f816c
no test in testsuite label
compiler-errors Oct 20, 2022
bf14e31
interpret: remove an incorrect assertion
RalfJung Oct 20, 2022
ebf5028
Improve "`~const` is not allowed here" message
fee1-dead Oct 20, 2022
7ee4b21
Rollup merge of #103221 - TaKO8Ki:fix-103202, r=oli-obk
matthiaskrgr Oct 20, 2022
be4816f
Rollup merge of #103230 - nnethercote:clarify-startup, r=jyn514
matthiaskrgr Oct 20, 2022
cfb424a
Rollup merge of #103281 - thomcc:long-overdue, r=jyn514
matthiaskrgr Oct 20, 2022
c6a680e
Rollup merge of #103288 - johnmatthiggins:master, r=thomcc
matthiaskrgr Oct 20, 2022
5bf18ad
Rollup merge of #103296 - GuillaumeGomez:collapse-expand-shortcuts, r…
matthiaskrgr Oct 20, 2022
1d97a58
Rollup merge of #103297 - catandcoder:master, r=JohnTitor
matthiaskrgr Oct 20, 2022
01111d4
Rollup merge of #103313 - compiler-errors:no-test, r=jyn514
matthiaskrgr Oct 20, 2022
801e326
Rollup merge of #103315 - RalfJung:interpret-switchint-ice, r=bjorn3
matthiaskrgr Oct 20, 2022
f9944a9
Rollup merge of #103319 - fee1-dead-contrib:improve_tilde_const_msg, …
matthiaskrgr Oct 20, 2022
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
Prev Previous commit
Next Next commit
+/- shortcut now only expand/collapse, not both
  • Loading branch information
GuillaumeGomez committed Oct 20, 2022
commit d3c37b1dfa62f8de2690e09c8e31ac8fbbd0dd2e
59 changes: 30 additions & 29 deletions src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,12 @@ function loadCss(cssFileName) {
break;

case "+":
ev.preventDefault();
expandAllDocs();
break;
case "-":
ev.preventDefault();
toggleAllDocs();
collapseAllDocs();
break;

case "?":
Expand Down Expand Up @@ -614,45 +617,43 @@ function loadCss(cssFileName) {
sidebarElems.appendChild(ul);
}

function expandAllDocs() {
const innerToggle = document.getElementById(toggleAllDocsId);
removeClass(innerToggle, "will-expand");
onEachLazy(document.getElementsByClassName("rustdoc-toggle"), e => {
if (!hasClass(e, "type-contents-toggle")) {
e.open = true;
}
});
innerToggle.title = "collapse all docs";
innerToggle.children[0].innerText = "\u2212"; // "\u2212" is "−" minus sign
}

function labelForToggleButton(sectionIsCollapsed) {
if (sectionIsCollapsed) {
// button will expand the section
return "+";
}
// button will collapse the section
// note that this text is also set in the HTML template in ../render/mod.rs
return "\u2212"; // "\u2212" is "−" minus sign
function collapseAllDocs() {
const innerToggle = document.getElementById(toggleAllDocsId);
addClass(innerToggle, "will-expand");
onEachLazy(document.getElementsByClassName("rustdoc-toggle"), e => {
if (e.parentNode.id !== "implementations-list" ||
(!hasClass(e, "implementors-toggle") &&
!hasClass(e, "type-contents-toggle"))
) {
e.open = false;
}
});
innerToggle.title = "expand all docs";
innerToggle.children[0].innerText = "+";
}

function toggleAllDocs() {
const innerToggle = document.getElementById(toggleAllDocsId);
if (!innerToggle) {
return;
}
let sectionIsCollapsed = false;
if (hasClass(innerToggle, "will-expand")) {
removeClass(innerToggle, "will-expand");
onEachLazy(document.getElementsByClassName("rustdoc-toggle"), e => {
if (!hasClass(e, "type-contents-toggle")) {
e.open = true;
}
});
innerToggle.title = "collapse all docs";
expandAllDocs();
} else {
addClass(innerToggle, "will-expand");
onEachLazy(document.getElementsByClassName("rustdoc-toggle"), e => {
if (e.parentNode.id !== "implementations-list" ||
(!hasClass(e, "implementors-toggle") &&
!hasClass(e, "type-contents-toggle"))
) {
e.open = false;
}
});
sectionIsCollapsed = true;
innerToggle.title = "expand all docs";
collapseAllDocs();
}
innerToggle.children[0].innerText = labelForToggleButton(sectionIsCollapsed);
}

(function() {
Expand Down