@@ -2595,7 +2595,7 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait)
25952595 }
25962596
25972597 // If there are methods directly on this trait object, render them here.
2598- render_assoc_items ( w, cx, it, it. def_id , & AssocItemRender :: All ) ;
2598+ render_assoc_items ( w, cx, it, it. def_id , AssocItemRender :: All ) ;
25992599
26002600 let mut synthetic_types = Vec :: new ( ) ;
26012601
@@ -2942,7 +2942,7 @@ fn item_struct(w: &mut Buffer, cx: &Context, it: &clean::Item, s: &clean::Struct
29422942 }
29432943 }
29442944 }
2945- render_assoc_items ( w, cx, it, it. def_id , & AssocItemRender :: All )
2945+ render_assoc_items ( w, cx, it, it. def_id , AssocItemRender :: All )
29462946}
29472947
29482948fn item_union ( w : & mut Buffer , cx : & Context , it : & clean:: Item , s : & clean:: Union ) {
@@ -2988,7 +2988,7 @@ fn item_union(w: &mut Buffer, cx: &Context, it: &clean::Item, s: &clean::Union)
29882988 document ( w, cx, field) ;
29892989 }
29902990 }
2991- render_assoc_items ( w, cx, it, it. def_id , & AssocItemRender :: All )
2991+ render_assoc_items ( w, cx, it, it. def_id , AssocItemRender :: All )
29922992}
29932993
29942994fn item_enum ( w : & mut Buffer , cx : & Context , it : & clean:: Item , e : & clean:: Enum ) {
@@ -3130,7 +3130,7 @@ fn item_enum(w: &mut Buffer, cx: &Context, it: &clean::Item, e: &clean::Enum) {
31303130 render_stability_since ( w, variant, it) ;
31313131 }
31323132 }
3133- render_assoc_items ( w, cx, it, it. def_id , & AssocItemRender :: All )
3133+ render_assoc_items ( w, cx, it, it. def_id , AssocItemRender :: All )
31343134}
31353135
31363136fn render_attribute ( attr : & ast:: MetaItem ) -> Option < String > {
@@ -3344,7 +3344,7 @@ fn render_assoc_items(
33443344 cx : & Context ,
33453345 containing_item : & clean:: Item ,
33463346 it : DefId ,
3347- what : & AssocItemRender < ' _ > ,
3347+ what : AssocItemRender < ' _ > ,
33483348) {
33493349 let c = & cx. cache ;
33503350 let v = match c. impls . get ( & it) {
@@ -3377,7 +3377,7 @@ fn render_assoc_items(
33773377 trait_. print( ) ,
33783378 type_. print( )
33793379 ) ;
3380- RenderMode :: ForDeref { mut_ : * deref_mut_ }
3380+ RenderMode :: ForDeref { mut_ : deref_mut_ }
33813381 }
33823382 } ;
33833383 for i in & non_trait {
@@ -3461,19 +3461,6 @@ fn render_assoc_items(
34613461 }
34623462}
34633463
3464- fn get_def_id ( real_target : & clean:: Type , cx : & Context ) -> Option < DefId > {
3465- if let Some ( did) = real_target. def_id ( ) {
3466- return Some ( did) ;
3467- } else {
3468- if let Some ( prim) = real_target. primitive_type ( ) {
3469- if let Some ( & did) = cx. cache . primitive_locations . get ( & prim) {
3470- return Some ( did) ;
3471- }
3472- }
3473- }
3474- None
3475- }
3476-
34773464fn render_deref_methods (
34783465 w : & mut Buffer ,
34793466 cx : & Context ,
@@ -3488,21 +3475,23 @@ fn render_deref_methods(
34883475 . iter ( )
34893476 . filter_map ( |item| match item. inner {
34903477 clean:: TypedefItem ( ref t, true ) => Some ( match * t {
3491- clean:: Typedef { item_type : Some ( ref type_) , .. } => ( & t. type_ , Some ( type_ ) ) ,
3492- _ => ( & t. type_ , None ) ,
3478+ clean:: Typedef { item_type : Some ( ref type_) , .. } => ( type_ , & t. type_ ) ,
3479+ _ => ( & t. type_ , & t . type_ ) ,
34933480 } ) ,
34943481 _ => None ,
34953482 } )
34963483 . next ( )
34973484 . expect ( "Expected associated type binding" ) ;
3498- let did = get_def_id ( & target, cx) ;
34993485 let what =
3500- AssocItemRender :: DerefFor { trait_ : deref_type, type_ : target, deref_mut_ : deref_mut } ;
3501- if let Some ( did) = did {
3502- render_assoc_items ( w, cx, container_item, did, & what) ;
3503- }
3504- if let Some ( did) = real_target. and_then ( |x| get_def_id ( x, cx) ) {
3505- render_assoc_items ( w, cx, container_item, did, & what) ;
3486+ AssocItemRender :: DerefFor { trait_ : deref_type, type_ : real_target, deref_mut_ : deref_mut } ;
3487+ if let Some ( did) = target. def_id ( ) {
3488+ render_assoc_items ( w, cx, container_item, did, what) ;
3489+ } else {
3490+ if let Some ( prim) = target. primitive_type ( ) {
3491+ if let Some ( & did) = cx. cache . primitive_locations . get ( & prim) {
3492+ render_assoc_items ( w, cx, container_item, did, what) ;
3493+ }
3494+ }
35063495 }
35073496}
35083497
@@ -3884,7 +3873,7 @@ fn item_opaque_ty(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Opa
38843873 // won't be visible anywhere in the docs. It would be nice to also show
38853874 // associated items from the aliased type (see discussion in #32077), but
38863875 // we need #14072 to make sense of the generics.
3887- render_assoc_items ( w, cx, it, it. def_id , & AssocItemRender :: All )
3876+ render_assoc_items ( w, cx, it, it. def_id , AssocItemRender :: All )
38883877}
38893878
38903879fn item_trait_alias ( w : & mut Buffer , cx : & Context , it : & clean:: Item , t : & clean:: TraitAlias ) {
@@ -3905,7 +3894,7 @@ fn item_trait_alias(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::T
39053894 // won't be visible anywhere in the docs. It would be nice to also show
39063895 // associated items from the aliased type (see discussion in #32077), but
39073896 // we need #14072 to make sense of the generics.
3908- render_assoc_items ( w, cx, it, it. def_id , & AssocItemRender :: All )
3897+ render_assoc_items ( w, cx, it, it. def_id , AssocItemRender :: All )
39093898}
39103899
39113900fn item_typedef ( w : & mut Buffer , cx : & Context , it : & clean:: Item , t : & clean:: Typedef ) {
@@ -3926,7 +3915,7 @@ fn item_typedef(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Typed
39263915 // won't be visible anywhere in the docs. It would be nice to also show
39273916 // associated items from the aliased type (see discussion in #32077), but
39283917 // we need #14072 to make sense of the generics.
3929- render_assoc_items ( w, cx, it, it. def_id , & AssocItemRender :: All )
3918+ render_assoc_items ( w, cx, it, it. def_id , AssocItemRender :: All )
39303919}
39313920
39323921fn item_foreign_type ( w : & mut Buffer , cx : & Context , it : & clean:: Item ) {
@@ -3941,7 +3930,7 @@ fn item_foreign_type(w: &mut Buffer, cx: &Context, it: &clean::Item) {
39413930
39423931 document ( w, cx, it) ;
39433932
3944- render_assoc_items ( w, cx, it, it. def_id , & AssocItemRender :: All )
3933+ render_assoc_items ( w, cx, it, it. def_id , AssocItemRender :: All )
39453934}
39463935
39473936fn print_sidebar ( cx : & Context , it : & clean:: Item , buffer : & mut Buffer ) {
@@ -4137,20 +4126,20 @@ fn sidebar_assoc_items(it: &clean::Item) -> String {
41374126 . filter ( |i| i. inner_impl ( ) . trait_ . is_some ( ) )
41384127 . find ( |i| i. inner_impl ( ) . trait_ . def_id ( ) == c. deref_trait_did )
41394128 {
4140- if let Some ( ( target, real_target ) ) = impl_
4129+ if let Some ( target) = impl_
41414130 . inner_impl ( )
41424131 . items
41434132 . iter ( )
41444133 . filter_map ( |item| match item. inner {
41454134 clean:: TypedefItem ( ref t, true ) => Some ( match * t {
4146- clean:: Typedef { item_type : Some ( ref type_) , .. } => ( & t . type_ , type_ ) ,
4147- _ => ( & t. type_ , & t . type_ ) ,
4135+ clean:: Typedef { item_type : Some ( ref type_) , .. } => type_,
4136+ _ => & t. type_ ,
41484137 } ) ,
41494138 _ => None ,
41504139 } )
41514140 . next ( )
41524141 {
4153- let inner_impl = real_target
4142+ let inner_impl = target
41544143 . def_id ( )
41554144 . or ( target
41564145 . primitive_type ( )
@@ -4613,7 +4602,7 @@ fn item_proc_macro(w: &mut Buffer, cx: &Context, it: &clean::Item, m: &clean::Pr
46134602
46144603fn item_primitive ( w : & mut Buffer , cx : & Context , it : & clean:: Item ) {
46154604 document ( w, cx, it) ;
4616- render_assoc_items ( w, cx, it, it. def_id , & AssocItemRender :: All )
4605+ render_assoc_items ( w, cx, it, it. def_id , AssocItemRender :: All )
46174606}
46184607
46194608fn item_keyword ( w : & mut Buffer , cx : & Context , it : & clean:: Item ) {
0 commit comments