@@ -1542,24 +1542,33 @@ fn render_impl(
15421542 }
15431543 }
15441544 let toggled = !impl_items. is_empty ( ) || !default_impl_items. is_empty ( ) ;
1545- let open_details = |close_tags : & mut String | {
1545+ let open_details = |close_tags : & mut String , is_collapsed : bool | {
15461546 if toggled {
15471547 close_tags. insert_str ( 0 , "</details>" ) ;
1548- "<details class=\" rustdoc-toggle implementors-toggle\" ><summary>"
1548+ if is_collapsed {
1549+ "<details class=\" rustdoc-toggle implementors-toggle\" ><summary>"
1550+ } else {
1551+ "<details class=\" rustdoc-toggle implementors-toggle\" open><summary>"
1552+ }
15491553 } else {
15501554 ""
15511555 }
15521556 } ;
15531557 if render_mode == RenderMode :: Normal {
1558+ let is_implementing_trait;
15541559 let id = cx. derive_id ( match i. inner_impl ( ) . trait_ {
15551560 Some ( ref t) => {
1561+ is_implementing_trait = true ;
15561562 if is_on_foreign_type {
15571563 get_id_for_impl_on_foreign_type ( & i. inner_impl ( ) . for_ , t, cx)
15581564 } else {
15591565 format ! ( "impl-{}" , small_url_encode( format!( "{:#}" , t. print( cx) ) ) )
15601566 }
15611567 }
1562- None => "impl" . to_string ( ) ,
1568+ None => {
1569+ is_implementing_trait = false ;
1570+ "impl" . to_string ( )
1571+ }
15631572 } ) ;
15641573 let aliases = if aliases. is_empty ( ) {
15651574 String :: new ( )
@@ -1570,7 +1579,7 @@ fn render_impl(
15701579 write ! (
15711580 w,
15721581 "{}<h3 id=\" {}\" class=\" impl\" {}><code class=\" in-band\" >" ,
1573- open_details( & mut close_tags) ,
1582+ open_details( & mut close_tags, is_implementing_trait ) ,
15741583 id,
15751584 aliases
15761585 ) ;
@@ -1597,7 +1606,7 @@ fn render_impl(
15971606 write ! (
15981607 w,
15991608 "{}<h3 id=\" {}\" class=\" impl\" {}><code class=\" in-band\" >{}</code>" ,
1600- open_details( & mut close_tags) ,
1609+ open_details( & mut close_tags, is_implementing_trait ) ,
16011610 id,
16021611 aliases,
16031612 i. inner_impl( ) . print( false , cx)
0 commit comments