@@ -1256,7 +1256,7 @@ fn render_assoc_items_inner(
1256
1256
let Some ( v) = cache. impls . get ( & it) else { return } ;
1257
1257
let ( non_trait, traits) : ( Vec < _ > , _ ) = v. iter ( ) . partition ( |i| i. inner_impl ( ) . trait_ . is_none ( ) ) ;
1258
1258
if !non_trait. is_empty ( ) {
1259
- let mut close_tags = String :: new ( ) ;
1259
+ let mut close_tags = < Vec < & str > > :: with_capacity ( 1 ) ;
1260
1260
let mut tmp_buf = Buffer :: html ( ) ;
1261
1261
let ( render_mode, id, class_html) = match what {
1262
1262
AssocItemRender :: All => {
@@ -1268,7 +1268,7 @@ fn render_assoc_items_inner(
1268
1268
cx. derive_id ( small_url_encode ( format ! ( "deref-methods-{:#}" , type_. print( cx) ) ) ) ;
1269
1269
let derived_id = cx. derive_id ( & id) ;
1270
1270
tmp_buf. write_str ( "<details class=\" toggle implementors-toggle\" open><summary>" ) ;
1271
- close_tags. insert_str ( 0 , "</details>" ) ;
1271
+ close_tags. push ( "</details>" ) ;
1272
1272
write_impl_section_heading (
1273
1273
& mut tmp_buf,
1274
1274
& format ! (
@@ -1312,7 +1312,9 @@ fn render_assoc_items_inner(
1312
1312
impls_buf. into_inner( )
1313
1313
)
1314
1314
. unwrap ( ) ;
1315
- w. write_str ( & close_tags) . unwrap ( ) ;
1315
+ for tag in close_tags. into_iter ( ) . rev ( ) {
1316
+ w. write_str ( tag) . unwrap ( ) ;
1317
+ }
1316
1318
}
1317
1319
}
1318
1320
@@ -1570,7 +1572,7 @@ fn render_impl(
1570
1572
let cache = & shared. cache ;
1571
1573
let traits = & cache. traits ;
1572
1574
let trait_ = i. trait_did ( ) . map ( |did| & traits[ & did] ) ;
1573
- let mut close_tags = String :: new ( ) ;
1575
+ let mut close_tags = < Vec < & str > > :: with_capacity ( 2 ) ;
1574
1576
1575
1577
// For trait implementations, the `interesting` output contains all methods that have doc
1576
1578
// comments, and the `boring` output contains all methods that do not. The distinction is
@@ -1858,7 +1860,7 @@ fn render_impl(
1858
1860
if render_mode == RenderMode :: Normal {
1859
1861
let toggled = !( impl_items. is_empty ( ) && default_impl_items. is_empty ( ) ) ;
1860
1862
if toggled {
1861
- close_tags. insert_str ( 0 , "</details>" ) ;
1863
+ close_tags. push ( "</details>" ) ;
1862
1864
write ! (
1863
1865
w,
1864
1866
"<details class=\" toggle implementors-toggle\" {}>\
@@ -1904,14 +1906,16 @@ fn render_impl(
1904
1906
}
1905
1907
if !default_impl_items. is_empty ( ) || !impl_items. is_empty ( ) {
1906
1908
w. write_str ( "<div class=\" impl-items\" >" ) ;
1907
- close_tags. insert_str ( 0 , "</div>" ) ;
1909
+ close_tags. push ( "</div>" ) ;
1908
1910
}
1909
1911
}
1910
1912
if !default_impl_items. is_empty ( ) || !impl_items. is_empty ( ) {
1911
1913
w. push_buffer ( default_impl_items) ;
1912
1914
w. push_buffer ( impl_items) ;
1913
1915
}
1914
- w. write_str ( & close_tags) ;
1916
+ for tag in close_tags. into_iter ( ) . rev ( ) {
1917
+ w. write_str ( tag) ;
1918
+ }
1915
1919
}
1916
1920
1917
1921
// Render the items that appear on the right side of methods, impls, and
0 commit comments