@@ -2241,8 +2241,7 @@ function defocusSearchBar() {
2241
2241
relatedDoc = relatedDoc . nextElementSibling ;
2242
2242
}
2243
2243
2244
- if ( ( ! relatedDoc && hasClass ( docblock , "docblock" ) === false ) ||
2245
- ( pageId && document . getElementById ( pageId ) ) ) {
2244
+ if ( ! relatedDoc && hasClass ( docblock , "docblock" ) === false ) {
2246
2245
return ;
2247
2246
}
2248
2247
@@ -2362,6 +2361,7 @@ function defocusSearchBar() {
2362
2361
( function ( ) {
2363
2362
var toggle = createSimpleToggle ( false ) ;
2364
2363
var hideMethodDocs = getCurrentValue ( "rustdoc-auto-hide-method-docs" ) === "true" ;
2364
+ var hideImplementors = getCurrentValue ( "rustdoc-auto-collapse-implementors" ) !== "false" ;
2365
2365
var pageId = getPageId ( ) ;
2366
2366
2367
2367
var func = function ( e ) {
@@ -2391,7 +2391,13 @@ function defocusSearchBar() {
2391
2391
if ( hasClass ( e , "impl" ) &&
2392
2392
( next . getElementsByClassName ( "method" ) . length > 0 ||
2393
2393
next . getElementsByClassName ( "associatedconstant" ) . length > 0 ) ) {
2394
- insertAfter ( toggle . cloneNode ( true ) , e . childNodes [ e . childNodes . length - 1 ] ) ;
2394
+ var newToggle = toggle . cloneNode ( true ) ;
2395
+ insertAfter ( newToggle , e . childNodes [ e . childNodes . length - 1 ] ) ;
2396
+ // In case the option "auto-collapse implementors" is not set to false, we collapse
2397
+ // all implementors.
2398
+ if ( hideImplementors === true && e . parentNode . id === "implementors-list" ) {
2399
+ collapseDocs ( newToggle , "hide" , pageId ) ;
2400
+ }
2395
2401
}
2396
2402
} ;
2397
2403
0 commit comments