@@ -2595,7 +2595,7 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait)
2595
2595
}
2596
2596
2597
2597
// 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 ) ;
2599
2599
2600
2600
let mut synthetic_types = Vec :: new ( ) ;
2601
2601
@@ -2942,7 +2942,7 @@ fn item_struct(w: &mut Buffer, cx: &Context, it: &clean::Item, s: &clean::Struct
2942
2942
}
2943
2943
}
2944
2944
}
2945
- render_assoc_items ( w, cx, it, it. def_id , & AssocItemRender :: All )
2945
+ render_assoc_items ( w, cx, it, it. def_id , AssocItemRender :: All )
2946
2946
}
2947
2947
2948
2948
fn 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)
2988
2988
document ( w, cx, field) ;
2989
2989
}
2990
2990
}
2991
- render_assoc_items ( w, cx, it, it. def_id , & AssocItemRender :: All )
2991
+ render_assoc_items ( w, cx, it, it. def_id , AssocItemRender :: All )
2992
2992
}
2993
2993
2994
2994
fn 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) {
3130
3130
render_stability_since ( w, variant, it) ;
3131
3131
}
3132
3132
}
3133
- render_assoc_items ( w, cx, it, it. def_id , & AssocItemRender :: All )
3133
+ render_assoc_items ( w, cx, it, it. def_id , AssocItemRender :: All )
3134
3134
}
3135
3135
3136
3136
fn render_attribute ( attr : & ast:: MetaItem ) -> Option < String > {
@@ -3344,7 +3344,7 @@ fn render_assoc_items(
3344
3344
cx : & Context ,
3345
3345
containing_item : & clean:: Item ,
3346
3346
it : DefId ,
3347
- what : & AssocItemRender < ' _ > ,
3347
+ what : AssocItemRender < ' _ > ,
3348
3348
) {
3349
3349
let c = & cx. cache ;
3350
3350
let v = match c. impls . get ( & it) {
@@ -3377,7 +3377,7 @@ fn render_assoc_items(
3377
3377
trait_. print( ) ,
3378
3378
type_. print( )
3379
3379
) ;
3380
- RenderMode :: ForDeref { mut_ : * deref_mut_ }
3380
+ RenderMode :: ForDeref { mut_ : deref_mut_ }
3381
3381
}
3382
3382
} ;
3383
3383
for i in & non_trait {
@@ -3461,19 +3461,6 @@ fn render_assoc_items(
3461
3461
}
3462
3462
}
3463
3463
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
-
3477
3464
fn render_deref_methods (
3478
3465
w : & mut Buffer ,
3479
3466
cx : & Context ,
@@ -3488,21 +3475,23 @@ fn render_deref_methods(
3488
3475
. iter ( )
3489
3476
. filter_map ( |item| match item. inner {
3490
3477
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_ ) ,
3493
3480
} ) ,
3494
3481
_ => None ,
3495
3482
} )
3496
3483
. next ( )
3497
3484
. expect ( "Expected associated type binding" ) ;
3498
- let did = get_def_id ( & target, cx) ;
3499
3485
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
+ }
3506
3495
}
3507
3496
}
3508
3497
@@ -3884,7 +3873,7 @@ fn item_opaque_ty(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Opa
3884
3873
// won't be visible anywhere in the docs. It would be nice to also show
3885
3874
// associated items from the aliased type (see discussion in #32077), but
3886
3875
// 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 )
3888
3877
}
3889
3878
3890
3879
fn 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
3905
3894
// won't be visible anywhere in the docs. It would be nice to also show
3906
3895
// associated items from the aliased type (see discussion in #32077), but
3907
3896
// 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 )
3909
3898
}
3910
3899
3911
3900
fn 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
3926
3915
// won't be visible anywhere in the docs. It would be nice to also show
3927
3916
// associated items from the aliased type (see discussion in #32077), but
3928
3917
// 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 )
3930
3919
}
3931
3920
3932
3921
fn 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) {
3941
3930
3942
3931
document ( w, cx, it) ;
3943
3932
3944
- render_assoc_items ( w, cx, it, it. def_id , & AssocItemRender :: All )
3933
+ render_assoc_items ( w, cx, it, it. def_id , AssocItemRender :: All )
3945
3934
}
3946
3935
3947
3936
fn print_sidebar ( cx : & Context , it : & clean:: Item , buffer : & mut Buffer ) {
@@ -4137,20 +4126,20 @@ fn sidebar_assoc_items(it: &clean::Item) -> String {
4137
4126
. filter ( |i| i. inner_impl ( ) . trait_ . is_some ( ) )
4138
4127
. find ( |i| i. inner_impl ( ) . trait_ . def_id ( ) == c. deref_trait_did )
4139
4128
{
4140
- if let Some ( ( target, real_target ) ) = impl_
4129
+ if let Some ( target) = impl_
4141
4130
. inner_impl ( )
4142
4131
. items
4143
4132
. iter ( )
4144
4133
. filter_map ( |item| match item. inner {
4145
4134
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_ ,
4148
4137
} ) ,
4149
4138
_ => None ,
4150
4139
} )
4151
4140
. next ( )
4152
4141
{
4153
- let inner_impl = real_target
4142
+ let inner_impl = target
4154
4143
. def_id ( )
4155
4144
. or ( target
4156
4145
. primitive_type ( )
@@ -4613,7 +4602,7 @@ fn item_proc_macro(w: &mut Buffer, cx: &Context, it: &clean::Item, m: &clean::Pr
4613
4602
4614
4603
fn item_primitive ( w : & mut Buffer , cx : & Context , it : & clean:: Item ) {
4615
4604
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 )
4617
4606
}
4618
4607
4619
4608
fn item_keyword ( w : & mut Buffer , cx : & Context , it : & clean:: Item ) {
0 commit comments