@@ -2198,8 +2198,7 @@ fn document(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item) -> fmt::Re
2198
2198
info ! ( "Documenting {}" , name) ;
2199
2199
}
2200
2200
document_stability ( w, cx, item) ?;
2201
- let prefix = render_assoc_const_value ( item) ;
2202
- document_full ( w, item, cx, & prefix) ?;
2201
+ document_full ( w, item, cx, "" ) ?;
2203
2202
Ok ( ( ) )
2204
2203
}
2205
2204
@@ -2231,20 +2230,6 @@ fn document_short(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item, link
2231
2230
Ok ( ( ) )
2232
2231
}
2233
2232
2234
- fn render_assoc_const_value ( item : & clean:: Item ) -> String {
2235
- match item. inner {
2236
- clean:: AssociatedConstItem ( ref ty, Some ( ref default) ) => {
2237
- highlight:: render_with_highlighting (
2238
- & format ! ( "{}: {:#} = {}" , item. name. as_ref( ) . unwrap( ) , ty, default ) ,
2239
- None ,
2240
- None ,
2241
- None ,
2242
- )
2243
- }
2244
- _ => String :: new ( ) ,
2245
- }
2246
- }
2247
-
2248
2233
fn document_full ( w : & mut fmt:: Formatter , item : & clean:: Item ,
2249
2234
cx : & Context , prefix : & str ) -> fmt:: Result {
2250
2235
if let Some ( s) = cx. shared . maybe_collapsed_doc_value ( item) {
@@ -3860,7 +3845,13 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
3860
3845
write ! ( w, "<h4 id='{}' class=\" {}\" >" , id, item_type) ?;
3861
3846
write ! ( w, "<span id='{}' class='invisible'><code>" , ns_id) ?;
3862
3847
assoc_const ( w, item, ty, default. as_ref ( ) , link. anchor ( & id) ) ?;
3863
- write ! ( w, "</code></span></h4>\n " ) ?;
3848
+ let src = if let Some ( l) = ( Item { cx, item } ) . src_href ( ) {
3849
+ format ! ( "<a class='srclink' href='{}' title='{}'>[src]</a>" ,
3850
+ l, "goto source code" )
3851
+ } else {
3852
+ String :: new ( )
3853
+ } ;
3854
+ write ! ( w, "</code>{}</span></h4>\n " , src) ?;
3864
3855
}
3865
3856
clean:: AssociatedTypeItem ( ref bounds, ref default) => {
3866
3857
let id = cx. derive_id ( format ! ( "{}.{}" , item_type, name) ) ;
@@ -3875,8 +3866,6 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
3875
3866
}
3876
3867
3877
3868
if render_method_item || render_mode == RenderMode :: Normal {
3878
- let prefix = render_assoc_const_value ( item) ;
3879
-
3880
3869
if !is_default_item {
3881
3870
if let Some ( t) = trait_ {
3882
3871
// The trait item may have been stripped so we might not
@@ -3886,23 +3875,23 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
3886
3875
// because impls can't have a stability.
3887
3876
document_stability ( w, cx, it) ?;
3888
3877
if item. doc_value ( ) . is_some ( ) {
3889
- document_full ( w, item, cx, & prefix ) ?;
3878
+ document_full ( w, item, cx, "" ) ?;
3890
3879
} else if show_def_docs {
3891
3880
// In case the item isn't documented,
3892
3881
// provide short documentation from the trait.
3893
- document_short ( w, cx, it, link, & prefix ) ?;
3882
+ document_short ( w, cx, it, link, "" ) ?;
3894
3883
}
3895
3884
}
3896
3885
} else {
3897
3886
document_stability ( w, cx, item) ?;
3898
3887
if show_def_docs {
3899
- document_full ( w, item, cx, & prefix ) ?;
3888
+ document_full ( w, item, cx, "" ) ?;
3900
3889
}
3901
3890
}
3902
3891
} else {
3903
3892
document_stability ( w, cx, item) ?;
3904
3893
if show_def_docs {
3905
- document_short ( w, cx, item, link, & prefix ) ?;
3894
+ document_short ( w, cx, item, link, "" ) ?;
3906
3895
}
3907
3896
}
3908
3897
}
0 commit comments