@@ -1542,24 +1542,33 @@ fn render_impl(
1542
1542
}
1543
1543
}
1544
1544
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 | {
1546
1546
if toggled {
1547
1547
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
+ }
1549
1553
} else {
1550
1554
""
1551
1555
}
1552
1556
} ;
1553
1557
if render_mode == RenderMode :: Normal {
1558
+ let is_implementing_trait;
1554
1559
let id = cx. derive_id ( match i. inner_impl ( ) . trait_ {
1555
1560
Some ( ref t) => {
1561
+ is_implementing_trait = true ;
1556
1562
if is_on_foreign_type {
1557
1563
get_id_for_impl_on_foreign_type ( & i. inner_impl ( ) . for_ , t, cx)
1558
1564
} else {
1559
1565
format ! ( "impl-{}" , small_url_encode( format!( "{:#}" , t. print( cx) ) ) )
1560
1566
}
1561
1567
}
1562
- None => "impl" . to_string ( ) ,
1568
+ None => {
1569
+ is_implementing_trait = false ;
1570
+ "impl" . to_string ( )
1571
+ }
1563
1572
} ) ;
1564
1573
let aliases = if aliases. is_empty ( ) {
1565
1574
String :: new ( )
@@ -1570,7 +1579,7 @@ fn render_impl(
1570
1579
write ! (
1571
1580
w,
1572
1581
"{}<h3 id=\" {}\" class=\" impl\" {}><code class=\" in-band\" >" ,
1573
- open_details( & mut close_tags) ,
1582
+ open_details( & mut close_tags, is_implementing_trait ) ,
1574
1583
id,
1575
1584
aliases
1576
1585
) ;
@@ -1597,7 +1606,7 @@ fn render_impl(
1597
1606
write ! (
1598
1607
w,
1599
1608
"{}<h3 id=\" {}\" class=\" impl\" {}><code class=\" in-band\" >{}</code>" ,
1600
- open_details( & mut close_tags) ,
1609
+ open_details( & mut close_tags, is_implementing_trait ) ,
1601
1610
id,
1602
1611
aliases,
1603
1612
i. inner_impl( ) . print( false , cx)
0 commit comments