diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 46002c089cf9f..fdc4d5d75b3d9 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -3037,15 +3037,14 @@ fn item_trait( let item_type = m.type_(); let id = cx.derive_id(format!("{}.{}", item_type, name)); let ns_id = cx.derive_id(format!("{}.{}", name, item_type.name_space())); - write!(w, "{extra}
",
+ write!(w, "{extra}",
extra = render_spotlight_traits(m)?,
id = id,
ns_id = ns_id)?;
render_assoc_item(w, m, AssocItemLink::Anchor(Some(&id)), ItemType::Impl)?;
write!(w, "
")?;
render_stability_since(w, m, t)?;
- write!(w, "
{name}: {ty}
- ",
+ write!(w, "\
+ \
+ {name}: {ty}
\
+ ",
item_type = ItemType::StructField,
id = id,
ns_id = ns_id,
@@ -3509,7 +3508,7 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
ItemType::Variant.name_space()));
write!(w, "\
\
- {name}",
+ {name}",
id = id,
ns_id = ns_id,
name = variant.name.as_ref().unwrap())?;
@@ -3525,7 +3524,7 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
write!(w, ")")?;
}
}
- write!(w, "
")?;
+ write!(w, "")?;
document(w, cx, variant)?;
use clean::{Variant, VariantKind};
@@ -3552,8 +3551,8 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
ItemType::StructField.name_space()));
write!(w, "\
\
- {f}: {t}\
-
",
+ {f}: {t}\
+
",
id = id,
ns_id = ns_id,
f = field.name.as_ref().unwrap(),
@@ -3998,7 +3997,7 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
id, i.inner_impl())?;
}
write!(w, "", id)?;
- write!(w, "")?;
+ write!(w, " |
", ns_id)?;
+ write!(w, "", ns_id)?;
assoc_type(w, item, &Vec::new(), Some(&tydef.type_), link.anchor(&id))?;
- write!(w, "
", ns_id)?;
+ if !version.is_empty() {
+ write!(w, "", ns_id)?;
+ } else {
+ write!(w, "", ns_id)?;
+ }
assoc_const(w, item, ty, default.as_ref(), link.anchor(&id))?;
+ if !version.is_empty() {
+ write!(w, "
")?;
+ }
let src = if let Some(l) = (Item { cx, item }).src_href() {
+ if !version.is_empty() {
+ write!(w, "
")?;
+ write!(w, "{}", version)?;
+ }
format!("[src]",
l, "goto source code")
} else {
+ if !version.is_empty() {
+ write!(w, " {}", version)?;
+ }
String::new()
};
- write!(w, "{}\n", src)?;
+ if version.is_empty() {
+ write!(w, "{}", src)?;
+ } else {
+ write!(w, "{}
", ns_id)?;
+ write!(w, "", ns_id)?;
assoc_type(w, item, bounds, default.as_ref(), link.anchor(&id))?;
- write!(w, "