Skip to content

Commit

Permalink
Add setting to prevent doc auto-hide of trait implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jul 8, 2018
1 parent 0c0315c commit c0ec5d5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/librustdoc/html/render.rs
Expand Up @@ -1669,6 +1669,8 @@ impl<'a> Settings<'a> {
settings: vec![
("item-declarations", "Auto-hide item declarations.", true),
("item-attributes", "Auto-hide item attributes.", true),
("trait-implementations", "Auto-hide trait implementations documentation",
true),
("go-to-only-result", "Directly go to item in search if there is only one result",
false),
],
Expand Down
22 changes: 12 additions & 10 deletions src/librustdoc/html/static/main.js
Expand Up @@ -1938,17 +1938,19 @@
if (collapse) {
toggleAllDocs(pageId, true);
}
onEach(document.getElementsByClassName("collapse-toggle"), function(e) {
// inherent impl ids are like 'impl' or impl-<number>'.
// they will never be hidden by default.
var n = e.parentNode;
if (n.id.match(/^impl(?:-\d+)?$/) === null) {
// Automatically minimize all non-inherent impls
if (collapse || hasClass(n, 'impl')) {
collapseDocs(e, "hide", pageId);
if (getCurrentValue('rustdoc-trait-implementations') !== "false") {
onEach(document.getElementsByClassName("collapse-toggle"), function(e) {
// inherent impl ids are like 'impl' or impl-<number>'.
// they will never be hidden by default.
var n = e.parentNode;
if (n.id.match(/^impl(?:-\d+)?$/) === null) {
// Automatically minimize all non-inherent impls
if (collapse || hasClass(n, 'impl')) {
collapseDocs(e, "hide", pageId);
}
}
}
});
});
}
}

var x = document.getElementById('toggle-all-docs');
Expand Down

0 comments on commit c0ec5d5

Please sign in to comment.