@@ -2274,9 +2274,9 @@ fn render_implementor(cx: &Context, implementor: &Impl, w: &mut fmt::Formatter,
2274
2274
}
2275
2275
2276
2276
fn render_impls ( cx : & Context , w : & mut fmt:: Formatter ,
2277
- traits : Vec < & & Impl > ,
2277
+ traits : & [ & & Impl ] ,
2278
2278
containing_item : & clean:: Item ) -> Result < ( ) , fmt:: Error > {
2279
- for i in & traits {
2279
+ for i in traits {
2280
2280
let did = i. trait_did ( ) . unwrap ( ) ;
2281
2281
let assoc_link = AssocItemLink :: GotoSource ( did, & i. inner_impl ( ) . provided_trait_methods ) ;
2282
2282
render_impl ( w, cx, i, assoc_link,
@@ -3172,14 +3172,22 @@ fn render_assoc_items(w: &mut fmt::Formatter,
3172
3172
. iter ( )
3173
3173
. partition :: < Vec < _ > , _ > ( |t| t. inner_impl ( ) . synthetic ) ;
3174
3174
3175
- write ! ( w, "
3176
- <h2 id='implementations' class='small-section-header'>
3177
- Trait Implementations<a href='#implementations' class='anchor'></a>
3178
- </h2>
3179
- <div id='implementations-list'>
3180
- " ) ?;
3181
- render_impls ( cx, w, concrete, containing_item) ?;
3182
- write ! ( w, "</div>" ) ?;
3175
+ struct RendererStruct < ' a , ' b , ' c > ( & ' a Context , Vec < & ' b & ' b Impl > , & ' c clean:: Item ) ;
3176
+
3177
+ impl < ' a , ' b , ' c > fmt:: Display for RendererStruct < ' a , ' b , ' c > {
3178
+ fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
3179
+ render_impls ( self . 0 , fmt, & self . 1 , self . 2 )
3180
+ }
3181
+ }
3182
+
3183
+ let impls = format ! ( "{}" , RendererStruct ( cx, concrete, containing_item) ) ;
3184
+ if !impls. is_empty ( ) {
3185
+ write ! ( w, "
3186
+ <h2 id='implementations' class='small-section-header'>
3187
+ Trait Implementations<a href='#implementations' class='anchor'></a>
3188
+ </h2>
3189
+ <div id='implementations-list'>{}</div>" , impls) ?;
3190
+ }
3183
3191
3184
3192
if !synthetic. is_empty ( ) {
3185
3193
write ! ( w, "
@@ -3188,7 +3196,7 @@ fn render_assoc_items(w: &mut fmt::Formatter,
3188
3196
</h2>
3189
3197
<div id='synthetic-implementations-list'>
3190
3198
" ) ?;
3191
- render_impls ( cx, w, synthetic, containing_item) ?;
3199
+ render_impls ( cx, w, & synthetic, containing_item) ?;
3192
3200
write ! ( w, "</div>" ) ?;
3193
3201
}
3194
3202
}
0 commit comments