@@ -2293,9 +2293,9 @@ fn render_implementor(cx: &Context, implementor: &Impl, w: &mut fmt::Formatter,
2293
2293
}
2294
2294
2295
2295
fn render_impls ( cx : & Context , w : & mut fmt:: Formatter ,
2296
- traits : Vec < & & Impl > ,
2296
+ traits : & [ & & Impl ] ,
2297
2297
containing_item : & clean:: Item ) -> Result < ( ) , fmt:: Error > {
2298
- for i in & traits {
2298
+ for i in traits {
2299
2299
let did = i. trait_did ( ) . unwrap ( ) ;
2300
2300
let assoc_link = AssocItemLink :: GotoSource ( did, & i. inner_impl ( ) . provided_trait_methods ) ;
2301
2301
render_impl ( w, cx, i, assoc_link,
@@ -3204,14 +3204,22 @@ fn render_assoc_items(w: &mut fmt::Formatter,
3204
3204
. iter ( )
3205
3205
. partition :: < Vec < _ > , _ > ( |t| t. inner_impl ( ) . synthetic ) ;
3206
3206
3207
- write ! ( w, "
3208
- <h2 id='implementations' class='small-section-header'>
3209
- Trait Implementations<a href='#implementations' class='anchor'></a>
3210
- </h2>
3211
- <div id='implementations-list'>
3212
- " ) ?;
3213
- render_impls ( cx, w, concrete, containing_item) ?;
3214
- write ! ( w, "</div>" ) ?;
3207
+ struct RendererStruct < ' a , ' b , ' c > ( & ' a Context , Vec < & ' b & ' b Impl > , & ' c clean:: Item ) ;
3208
+
3209
+ impl < ' a , ' b , ' c > fmt:: Display for RendererStruct < ' a , ' b , ' c > {
3210
+ fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
3211
+ render_impls ( self . 0 , fmt, & self . 1 , self . 2 )
3212
+ }
3213
+ }
3214
+
3215
+ let impls = format ! ( "{}" , RendererStruct ( cx, concrete, containing_item) ) ;
3216
+ if !impls. is_empty ( ) {
3217
+ write ! ( w, "
3218
+ <h2 id='implementations' class='small-section-header'>
3219
+ Trait Implementations<a href='#implementations' class='anchor'></a>
3220
+ </h2>
3221
+ <div id='implementations-list'>{}</div>" , impls) ?;
3222
+ }
3215
3223
3216
3224
if !synthetic. is_empty ( ) {
3217
3225
write ! ( w, "
@@ -3220,7 +3228,7 @@ fn render_assoc_items(w: &mut fmt::Formatter,
3220
3228
</h2>
3221
3229
<div id='synthetic-implementations-list'>
3222
3230
" ) ?;
3223
- render_impls ( cx, w, synthetic, containing_item) ?;
3231
+ render_impls ( cx, w, & synthetic, containing_item) ?;
3224
3232
write ! ( w, "</div>" ) ?;
3225
3233
}
3226
3234
}
0 commit comments