Don't show associated const value anymore
This commit is contained in:
parent
727eabd681
commit
a54594430f
2 changed files with 20 additions and 23 deletions
|
@ -2198,8 +2198,7 @@ fn document(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item) -> fmt::Re
|
||||||
info!("Documenting {}", name);
|
info!("Documenting {}", name);
|
||||||
}
|
}
|
||||||
document_stability(w, cx, item)?;
|
document_stability(w, cx, item)?;
|
||||||
let prefix = render_assoc_const_value(item);
|
document_full(w, item, cx, "")?;
|
||||||
document_full(w, item, cx, &prefix)?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2231,20 +2230,6 @@ fn document_short(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item, link
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_assoc_const_value(item: &clean::Item) -> String {
|
|
||||||
match item.inner {
|
|
||||||
clean::AssociatedConstItem(ref ty, Some(ref default)) => {
|
|
||||||
highlight::render_with_highlighting(
|
|
||||||
&format!("{}: {:#} = {}", item.name.as_ref().unwrap(), ty, default),
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
_ => String::new(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn document_full(w: &mut fmt::Formatter, item: &clean::Item,
|
fn document_full(w: &mut fmt::Formatter, item: &clean::Item,
|
||||||
cx: &Context, prefix: &str) -> fmt::Result {
|
cx: &Context, prefix: &str) -> fmt::Result {
|
||||||
if let Some(s) = cx.shared.maybe_collapsed_doc_value(item) {
|
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
|
||||||
write!(w, "<h4 id='{}' class=\"{}\">", id, item_type)?;
|
write!(w, "<h4 id='{}' class=\"{}\">", id, item_type)?;
|
||||||
write!(w, "<span id='{}' class='invisible'><code>", ns_id)?;
|
write!(w, "<span id='{}' class='invisible'><code>", ns_id)?;
|
||||||
assoc_const(w, item, ty, default.as_ref(), link.anchor(&id))?;
|
assoc_const(w, item, ty, default.as_ref(), link.anchor(&id))?;
|
||||||
write!(w, "</code></span></h4>\n")?;
|
let src = if let Some(l) = (Item { cx, item }).src_href() {
|
||||||
|
format!("<a class='srclink' href='{}' title='{}'>[src]</a>",
|
||||||
|
l, "goto source code")
|
||||||
|
} else {
|
||||||
|
String::new()
|
||||||
|
};
|
||||||
|
write!(w, "</code>{}</span></h4>\n", src)?;
|
||||||
}
|
}
|
||||||
clean::AssociatedTypeItem(ref bounds, ref default) => {
|
clean::AssociatedTypeItem(ref bounds, ref default) => {
|
||||||
let id = cx.derive_id(format!("{}.{}", item_type, name));
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
if render_method_item || render_mode == RenderMode::Normal {
|
if render_method_item || render_mode == RenderMode::Normal {
|
||||||
let prefix = render_assoc_const_value(item);
|
|
||||||
|
|
||||||
if !is_default_item {
|
if !is_default_item {
|
||||||
if let Some(t) = trait_ {
|
if let Some(t) = trait_ {
|
||||||
// The trait item may have been stripped so we might not
|
// 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
|
||||||
// because impls can't have a stability.
|
// because impls can't have a stability.
|
||||||
document_stability(w, cx, it)?;
|
document_stability(w, cx, it)?;
|
||||||
if item.doc_value().is_some() {
|
if item.doc_value().is_some() {
|
||||||
document_full(w, item, cx, &prefix)?;
|
document_full(w, item, cx, "")?;
|
||||||
} else if show_def_docs {
|
} else if show_def_docs {
|
||||||
// In case the item isn't documented,
|
// In case the item isn't documented,
|
||||||
// provide short documentation from the trait.
|
// provide short documentation from the trait.
|
||||||
document_short(w, cx, it, link, &prefix)?;
|
document_short(w, cx, it, link, "")?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
document_stability(w, cx, item)?;
|
document_stability(w, cx, item)?;
|
||||||
if show_def_docs {
|
if show_def_docs {
|
||||||
document_full(w, item, cx, &prefix)?;
|
document_full(w, item, cx, "")?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
document_stability(w, cx, item)?;
|
document_stability(w, cx, item)?;
|
||||||
if show_def_docs {
|
if show_def_docs {
|
||||||
document_short(w, cx, item, link, &prefix)?;
|
document_short(w, cx, item, link, "")?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -559,6 +559,14 @@ a {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.invisible > .srclink {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
font-size: 17px;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
.block a.current.crate { font-weight: 500; }
|
.block a.current.crate { font-weight: 500; }
|
||||||
|
|
||||||
.search-container {
|
.search-container {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue