@@ -2241,8 +2241,7 @@ function defocusSearchBar() {
22412241 relatedDoc = relatedDoc . nextElementSibling ;
22422242 }
22432243
2244- if ( ( ! relatedDoc && hasClass ( docblock , "docblock" ) === false ) ||
2245- ( pageId && document . getElementById ( pageId ) ) ) {
2244+ if ( ! relatedDoc && hasClass ( docblock , "docblock" ) === false ) {
22462245 return ;
22472246 }
22482247
@@ -2362,6 +2361,7 @@ function defocusSearchBar() {
23622361 ( function ( ) {
23632362 var toggle = createSimpleToggle ( false ) ;
23642363 var hideMethodDocs = getCurrentValue ( "rustdoc-auto-hide-method-docs" ) === "true" ;
2364+ var hideImplementors = getCurrentValue ( "rustdoc-auto-collapse-implementors" ) !== "false" ;
23652365 var pageId = getPageId ( ) ;
23662366
23672367 var func = function ( e ) {
@@ -2391,7 +2391,13 @@ function defocusSearchBar() {
23912391 if ( hasClass ( e , "impl" ) &&
23922392 ( next . getElementsByClassName ( "method" ) . length > 0 ||
23932393 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+ }
23952401 }
23962402 } ;
23972403
0 commit comments