@@ -2213,8 +2213,7 @@ fn document(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item) -> fmt::Re
2213
2213
info ! ( "Documenting {}" , name) ;
2214
2214
}
2215
2215
document_stability ( w, cx, item) ?;
2216
- let prefix = render_assoc_const_value ( item) ;
2217
- document_full ( w, item, cx, & prefix) ?;
2216
+ document_full ( w, item, cx, "" ) ?;
2218
2217
Ok ( ( ) )
2219
2218
}
2220
2219
@@ -2246,20 +2245,6 @@ fn document_short(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item, link
2246
2245
Ok ( ( ) )
2247
2246
}
2248
2247
2249
- fn render_assoc_const_value ( item : & clean:: Item ) -> String {
2250
- match item. inner {
2251
- clean:: AssociatedConstItem ( ref ty, Some ( ref default) ) => {
2252
- highlight:: render_with_highlighting (
2253
- & format ! ( "{}: {:#} = {}" , item. name. as_ref( ) . unwrap( ) , ty, default ) ,
2254
- None ,
2255
- None ,
2256
- None ,
2257
- )
2258
- }
2259
- _ => String :: new ( ) ,
2260
- }
2261
- }
2262
-
2263
2248
fn document_full ( w : & mut fmt:: Formatter , item : & clean:: Item ,
2264
2249
cx : & Context , prefix : & str ) -> fmt:: Result {
2265
2250
if let Some ( s) = cx. shared . maybe_collapsed_doc_value ( item) {
@@ -2609,27 +2594,15 @@ fn short_stability(item: &clean::Item, cx: &Context, show_reason: bool) -> Vec<S
2609
2594
stability
2610
2595
}
2611
2596
2612
- struct Initializer < ' a > ( & ' a str ) ;
2613
-
2614
- impl < ' a > fmt:: Display for Initializer < ' a > {
2615
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
2616
- let Initializer ( s) = * self ;
2617
- if s. is_empty ( ) { return Ok ( ( ) ) ; }
2618
- write ! ( f, "<code> = </code>" ) ?;
2619
- write ! ( f, "<code>{}</code>" , Escape ( s) )
2620
- }
2621
- }
2622
-
2623
2597
fn item_constant ( w : & mut fmt:: Formatter , cx : & Context , it : & clean:: Item ,
2624
2598
c : & clean:: Constant ) -> fmt:: Result {
2625
2599
write ! ( w, "<pre class='rust const'>" ) ?;
2626
2600
render_attributes ( w, it) ?;
2627
2601
write ! ( w, "{vis}const \
2628
- {name}: {typ}{init} </pre>",
2602
+ {name}: {typ}</pre>",
2629
2603
vis = VisSpace ( & it. visibility) ,
2630
2604
name = it. name. as_ref( ) . unwrap( ) ,
2631
- typ = c. type_,
2632
- init = Initializer ( & c. expr) ) ?;
2605
+ typ = c. type_) ?;
2633
2606
document ( w, cx, it)
2634
2607
}
2635
2608
@@ -2638,12 +2611,11 @@ fn item_static(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
2638
2611
write ! ( w, "<pre class='rust static'>" ) ?;
2639
2612
render_attributes ( w, it) ?;
2640
2613
write ! ( w, "{vis}static {mutability}\
2641
- {name}: {typ}{init} </pre>",
2614
+ {name}: {typ}</pre>",
2642
2615
vis = VisSpace ( & it. visibility) ,
2643
2616
mutability = MutableSpace ( s. mutability) ,
2644
2617
name = it. name. as_ref( ) . unwrap( ) ,
2645
- typ = s. type_,
2646
- init = Initializer ( & s. expr) ) ?;
2618
+ typ = s. type_) ?;
2647
2619
document ( w, cx, it)
2648
2620
}
2649
2621
@@ -3878,7 +3850,13 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
3878
3850
write ! ( w, "<h4 id='{}' class=\" {}\" >" , id, item_type) ?;
3879
3851
write ! ( w, "<span id='{}' class='invisible'><code>" , ns_id) ?;
3880
3852
assoc_const ( w, item, ty, default. as_ref ( ) , link. anchor ( & id) ) ?;
3881
- write ! ( w, "</code></span></h4>\n " ) ?;
3853
+ let src = if let Some ( l) = ( Item { cx, item } ) . src_href ( ) {
3854
+ format ! ( "<a class='srclink' href='{}' title='{}'>[src]</a>" ,
3855
+ l, "goto source code" )
3856
+ } else {
3857
+ String :: new ( )
3858
+ } ;
3859
+ write ! ( w, "</code>{}</span></h4>\n " , src) ?;
3882
3860
}
3883
3861
clean:: AssociatedTypeItem ( ref bounds, ref default) => {
3884
3862
let id = cx. derive_id ( format ! ( "{}.{}" , item_type, name) ) ;
@@ -3893,8 +3871,6 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
3893
3871
}
3894
3872
3895
3873
if render_method_item || render_mode == RenderMode :: Normal {
3896
- let prefix = render_assoc_const_value ( item) ;
3897
-
3898
3874
if !is_default_item {
3899
3875
if let Some ( t) = trait_ {
3900
3876
// The trait item may have been stripped so we might not
@@ -3904,23 +3880,23 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
3904
3880
// because impls can't have a stability.
3905
3881
document_stability ( w, cx, it) ?;
3906
3882
if item. doc_value ( ) . is_some ( ) {
3907
- document_full ( w, item, cx, & prefix ) ?;
3883
+ document_full ( w, item, cx, "" ) ?;
3908
3884
} else if show_def_docs {
3909
3885
// In case the item isn't documented,
3910
3886
// provide short documentation from the trait.
3911
- document_short ( w, cx, it, link, & prefix ) ?;
3887
+ document_short ( w, cx, it, link, "" ) ?;
3912
3888
}
3913
3889
}
3914
3890
} else {
3915
3891
document_stability ( w, cx, item) ?;
3916
3892
if show_def_docs {
3917
- document_full ( w, item, cx, & prefix ) ?;
3893
+ document_full ( w, item, cx, "" ) ?;
3918
3894
}
3919
3895
}
3920
3896
} else {
3921
3897
document_stability ( w, cx, item) ?;
3922
3898
if show_def_docs {
3923
- document_short ( w, cx, item, link, & prefix ) ?;
3899
+ document_short ( w, cx, item, link, "" ) ?;
3924
3900
}
3925
3901
}
3926
3902
}
0 commit comments