@@ -2213,8 +2213,7 @@ fn document(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item) -> fmt::Re
22132213 info ! ( "Documenting {}" , name) ;
22142214 }
22152215 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, "" ) ?;
22182217 Ok ( ( ) )
22192218}
22202219
@@ -2246,20 +2245,6 @@ fn document_short(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item, link
22462245 Ok ( ( ) )
22472246}
22482247
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-
22632248fn document_full ( w : & mut fmt:: Formatter , item : & clean:: Item ,
22642249 cx : & Context , prefix : & str ) -> fmt:: Result {
22652250 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
26092594 stability
26102595}
26112596
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-
26232597fn item_constant ( w : & mut fmt:: Formatter , cx : & Context , it : & clean:: Item ,
26242598 c : & clean:: Constant ) -> fmt:: Result {
26252599 write ! ( w, "<pre class='rust const'>" ) ?;
26262600 render_attributes ( w, it) ?;
26272601 write ! ( w, "{vis}const \
2628- {name}: {typ}{init} </pre>",
2602+ {name}: {typ}</pre>",
26292603 vis = VisSpace ( & it. visibility) ,
26302604 name = it. name. as_ref( ) . unwrap( ) ,
2631- typ = c. type_,
2632- init = Initializer ( & c. expr) ) ?;
2605+ typ = c. type_) ?;
26332606 document ( w, cx, it)
26342607}
26352608
@@ -2638,12 +2611,11 @@ fn item_static(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
26382611 write ! ( w, "<pre class='rust static'>" ) ?;
26392612 render_attributes ( w, it) ?;
26402613 write ! ( w, "{vis}static {mutability}\
2641- {name}: {typ}{init} </pre>",
2614+ {name}: {typ}</pre>",
26422615 vis = VisSpace ( & it. visibility) ,
26432616 mutability = MutableSpace ( s. mutability) ,
26442617 name = it. name. as_ref( ) . unwrap( ) ,
2645- typ = s. type_,
2646- init = Initializer ( & s. expr) ) ?;
2618+ typ = s. type_) ?;
26472619 document ( w, cx, it)
26482620}
26492621
@@ -3878,7 +3850,13 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
38783850 write ! ( w, "<h4 id='{}' class=\" {}\" >" , id, item_type) ?;
38793851 write ! ( w, "<span id='{}' class='invisible'><code>" , ns_id) ?;
38803852 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) ?;
38823860 }
38833861 clean:: AssociatedTypeItem ( ref bounds, ref default) => {
38843862 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
38933871 }
38943872
38953873 if render_method_item || render_mode == RenderMode :: Normal {
3896- let prefix = render_assoc_const_value ( item) ;
3897-
38983874 if !is_default_item {
38993875 if let Some ( t) = trait_ {
39003876 // 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
39043880 // because impls can't have a stability.
39053881 document_stability ( w, cx, it) ?;
39063882 if item. doc_value ( ) . is_some ( ) {
3907- document_full ( w, item, cx, & prefix ) ?;
3883+ document_full ( w, item, cx, "" ) ?;
39083884 } else if show_def_docs {
39093885 // In case the item isn't documented,
39103886 // provide short documentation from the trait.
3911- document_short ( w, cx, it, link, & prefix ) ?;
3887+ document_short ( w, cx, it, link, "" ) ?;
39123888 }
39133889 }
39143890 } else {
39153891 document_stability ( w, cx, item) ?;
39163892 if show_def_docs {
3917- document_full ( w, item, cx, & prefix ) ?;
3893+ document_full ( w, item, cx, "" ) ?;
39183894 }
39193895 }
39203896 } else {
39213897 document_stability ( w, cx, item) ?;
39223898 if show_def_docs {
3923- document_short ( w, cx, item, link, & prefix ) ?;
3899+ document_short ( w, cx, item, link, "" ) ?;
39243900 }
39253901 }
39263902 }
0 commit comments