@@ -1250,6 +1250,7 @@ fn render_assoc_items_inner(
1250
1250
let Some ( v) = cache. impls . get ( & it) else { return } ;
1251
1251
let ( non_trait, traits) : ( Vec < _ > , _ ) = v. iter ( ) . partition ( |i| i. inner_impl ( ) . trait_ . is_none ( ) ) ;
1252
1252
if !non_trait. is_empty ( ) {
1253
+ let mut close_tags = <Vec < & str > >:: with_capacity ( 1 ) ;
1253
1254
let mut tmp_buf = Buffer :: html ( ) ;
1254
1255
let ( render_mode, id, class_html) = match what {
1255
1256
AssocItemRender :: All => {
@@ -1260,6 +1261,8 @@ fn render_assoc_items_inner(
1260
1261
let id =
1261
1262
cx. derive_id ( small_url_encode ( format ! ( "deref-methods-{:#}" , type_. print( cx) ) ) ) ;
1262
1263
let derived_id = cx. derive_id ( & id) ;
1264
+ tmp_buf. write_str ( "<details class=\" toggle big-toggle\" open><summary>" ) ;
1265
+ close_tags. push ( "</details>" ) ;
1263
1266
write_impl_section_heading (
1264
1267
& mut tmp_buf,
1265
1268
& format ! (
@@ -1269,6 +1272,7 @@ fn render_assoc_items_inner(
1269
1272
) ,
1270
1273
& id,
1271
1274
) ;
1275
+ tmp_buf. write_str ( "</summary>" ) ;
1272
1276
if let Some ( def_id) = type_. def_id ( cx. cache ( ) ) {
1273
1277
cx. deref_id_map . insert ( def_id, id) ;
1274
1278
}
@@ -1302,6 +1306,9 @@ fn render_assoc_items_inner(
1302
1306
impls_buf. into_inner( )
1303
1307
)
1304
1308
. unwrap ( ) ;
1309
+ for tag in close_tags. into_iter ( ) . rev ( ) {
1310
+ w. write_str ( tag) . unwrap ( ) ;
1311
+ }
1305
1312
}
1306
1313
}
1307
1314
@@ -1558,7 +1565,7 @@ fn render_impl(
1558
1565
let cache = & shared. cache ;
1559
1566
let traits = & cache. traits ;
1560
1567
let trait_ = i. trait_did ( ) . map ( |did| & traits[ & did] ) ;
1561
- let mut close_tags = String :: new ( ) ;
1568
+ let mut close_tags = < Vec < & str > > :: with_capacity ( 2 ) ;
1562
1569
1563
1570
// For trait implementations, the `interesting` output contains all methods that have doc
1564
1571
// comments, and the `boring` output contains all methods that do not. The distinction is
@@ -1870,7 +1877,7 @@ fn render_impl(
1870
1877
if render_mode == RenderMode :: Normal {
1871
1878
let toggled = !( impl_items. is_empty ( ) && default_impl_items. is_empty ( ) ) ;
1872
1879
if toggled {
1873
- close_tags. insert_str ( 0 , "</details>" ) ;
1880
+ close_tags. push ( "</details>" ) ;
1874
1881
write ! (
1875
1882
w,
1876
1883
"<details class=\" toggle implementors-toggle\" {}>\
@@ -1916,14 +1923,16 @@ fn render_impl(
1916
1923
}
1917
1924
if !default_impl_items. is_empty ( ) || !impl_items. is_empty ( ) {
1918
1925
w. write_str ( "<div class=\" impl-items\" >" ) ;
1919
- close_tags. insert_str ( 0 , "</div>" ) ;
1926
+ close_tags. push ( "</div>" ) ;
1920
1927
}
1921
1928
}
1922
1929
if !default_impl_items. is_empty ( ) || !impl_items. is_empty ( ) {
1923
1930
w. push_buffer ( default_impl_items) ;
1924
1931
w. push_buffer ( impl_items) ;
1925
1932
}
1926
- w. write_str ( & close_tags) ;
1933
+ for tag in close_tags. into_iter ( ) . rev ( ) {
1934
+ w. write_str ( tag) ;
1935
+ }
1927
1936
}
1928
1937
1929
1938
// Render the items that appear on the right side of methods, impls, and
0 commit comments