@@ -1256,6 +1256,7 @@ fn render_assoc_items_inner(
12561256let Some ( v) = cache. impls . get ( & it) else { return } ;
12571257let ( non_trait, traits) : ( Vec < _ > , _ ) = v. iter ( ) . partition ( |i| i. inner_impl ( ) . trait_ . is_none ( ) ) ;
12581258if !non_trait. is_empty ( ) {
1259+ let mut close_tags = <Vec < & str > >:: with_capacity ( 1 ) ;
12591260let mut tmp_buf = Buffer :: html ( ) ;
12601261let ( render_mode, id, class_html) = match what {
12611262AssocItemRender :: All => {
@@ -1266,6 +1267,8 @@ fn render_assoc_items_inner(
12661267let id =
12671268 cx. derive_id ( small_url_encode ( format ! ( "deref-methods-{:#}" , type_. print( cx) ) ) ) ;
12681269let derived_id = cx. derive_id ( & id) ;
1270+ tmp_buf. write_str ( "<details class=\" toggle implementors-toggle\" open><summary>" ) ;
1271+ close_tags. push ( "</details>" ) ;
12691272write_impl_section_heading (
12701273& mut tmp_buf,
12711274& format ! (
@@ -1275,6 +1278,7 @@ fn render_assoc_items_inner(
12751278) ,
12761279& id,
12771280) ;
1281+ tmp_buf. write_str ( "</summary>" ) ;
12781282if let Some ( def_id) = type_. def_id ( cx. cache ( ) ) {
12791283 cx. deref_id_map . insert ( def_id, id) ;
12801284}
@@ -1308,6 +1312,9 @@ fn render_assoc_items_inner(
13081312 impls_buf. into_inner( )
13091313)
13101314. unwrap ( ) ;
1315+ for tag in close_tags. into_iter ( ) . rev ( ) {
1316+ w. write_str ( tag) . unwrap ( ) ;
1317+ }
13111318}
13121319}
13131320
@@ -1565,7 +1572,7 @@ fn render_impl(
15651572let cache = & shared. cache ;
15661573let traits = & cache. traits ;
15671574let trait_ = i. trait_did ( ) . map ( |did| & traits[ & did] ) ;
1568- let mut close_tags = String :: new ( ) ;
1575+ let mut close_tags = < Vec < & str > > :: with_capacity ( 2 ) ;
15691576
15701577// For trait implementations, the `interesting` output contains all methods that have doc
15711578// comments, and the `boring` output contains all methods that do not. The distinction is
@@ -1853,7 +1860,7 @@ fn render_impl(
18531860if render_mode == RenderMode :: Normal {
18541861let toggled = !( impl_items. is_empty ( ) && default_impl_items. is_empty ( ) ) ;
18551862if toggled {
1856- close_tags. insert_str ( 0 , "</details>" ) ;
1863+ close_tags. push ( "</details>" ) ;
18571864write ! (
18581865 w,
18591866"<details class=\" toggle implementors-toggle\" {}>\
@@ -1899,14 +1906,16 @@ fn render_impl(
18991906}
19001907if !default_impl_items. is_empty ( ) || !impl_items. is_empty ( ) {
19011908 w. write_str ( "<div class=\" impl-items\" >" ) ;
1902- close_tags. insert_str ( 0 , "</div>" ) ;
1909+ close_tags. push ( "</div>" ) ;
19031910}
19041911}
19051912if !default_impl_items. is_empty ( ) || !impl_items. is_empty ( ) {
19061913 w. push_buffer ( default_impl_items) ;
19071914 w. push_buffer ( impl_items) ;
19081915}
1909- w. write_str ( & close_tags) ;
1916+ for tag in close_tags. into_iter ( ) . rev ( ) {
1917+ w. write_str ( tag) ;
1918+ }
19101919}
19111920
19121921// Render the items that appear on the right side of methods, impls, and
0 commit comments