@@ -2253,6 +2253,18 @@ fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
2253
2253
document ( w, cx, it)
2254
2254
}
2255
2255
2256
+ fn implementor2item < ' a > ( cache : & ' a Cache , imp : & Implementor ) -> Option < & ' a clean:: Item > {
2257
+ if let Some ( t_did) = imp. impl_ . for_ . def_id ( ) {
2258
+ if let Some ( impl_item) = cache. impls . get ( & t_did) . and_then ( |i| i. iter ( )
2259
+ . find ( |i| i. impl_item . def_id == imp. def_id ) )
2260
+ {
2261
+ let i = & impl_item. impl_item ;
2262
+ return Some ( i) ;
2263
+ }
2264
+ }
2265
+ None
2266
+ }
2267
+
2256
2268
fn item_trait ( w : & mut fmt:: Formatter , cx : & Context , it : & clean:: Item ,
2257
2269
t : & clean:: Trait ) -> fmt:: Result {
2258
2270
let mut bounds = String :: new ( ) ;
@@ -2463,19 +2475,13 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
2463
2475
" ) ?;
2464
2476
2465
2477
for implementor in foreign {
2466
- // need to get from a clean::Impl to a clean::Item so i can use render_impl
2467
- if let Some ( t_did) = implementor. impl_ . for_ . def_id ( ) {
2468
- if let Some ( impl_item) = cache. impls . get ( & t_did) . and_then ( |i| i. iter ( )
2469
- . find ( |i| i. impl_item . def_id == implementor. def_id ) )
2470
- {
2471
- let i = & impl_item. impl_item ;
2472
- let impl_ = Impl { impl_item : i. clone ( ) } ;
2473
- let assoc_link = AssocItemLink :: GotoSource (
2474
- i. def_id , & implementor. impl_ . provided_trait_methods
2475
- ) ;
2476
- render_impl ( w, cx, & impl_, assoc_link,
2477
- RenderMode :: Normal , i. stable_since ( ) , false ) ?;
2478
- }
2478
+ if let Some ( i) = implementor2item ( & cache, implementor) {
2479
+ let impl_ = Impl { impl_item : i. clone ( ) } ;
2480
+ let assoc_link = AssocItemLink :: GotoSource (
2481
+ i. def_id , & implementor. impl_ . provided_trait_methods
2482
+ ) ;
2483
+ render_impl ( w, cx, & impl_, assoc_link,
2484
+ RenderMode :: Normal , i. stable_since ( ) , false ) ?;
2479
2485
}
2480
2486
}
2481
2487
}
0 commit comments