mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-27 07:03:45 +00:00
Remove the extra DOM level if there is only one child in rightside elements
This commit is contained in:
parent
097b3823dd
commit
d40a18eb3d
@ -834,12 +834,13 @@ fn assoc_method(
|
|||||||
/// Note that it is possible for an unstable function to be const-stable. In that case, the span
|
/// Note that it is possible for an unstable function to be const-stable. In that case, the span
|
||||||
/// will include the const-stable version, but no stable version will be emitted, as a natural
|
/// will include the const-stable version, but no stable version will be emitted, as a natural
|
||||||
/// consequence of the above rules.
|
/// consequence of the above rules.
|
||||||
fn render_stability_since_raw(
|
fn render_stability_since_raw_with_extra(
|
||||||
w: &mut Buffer,
|
w: &mut Buffer,
|
||||||
ver: Option<Symbol>,
|
ver: Option<Symbol>,
|
||||||
const_stability: Option<ConstStability>,
|
const_stability: Option<ConstStability>,
|
||||||
containing_ver: Option<Symbol>,
|
containing_ver: Option<Symbol>,
|
||||||
containing_const_ver: Option<Symbol>,
|
containing_const_ver: Option<Symbol>,
|
||||||
|
extra_class: &str,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let stable_version = ver.filter(|inner| !inner.is_empty() && Some(*inner) != containing_ver);
|
let stable_version = ver.filter(|inner| !inner.is_empty() && Some(*inner) != containing_ver);
|
||||||
|
|
||||||
@ -887,12 +888,30 @@ fn render_stability_since_raw(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !stability.is_empty() {
|
if !stability.is_empty() {
|
||||||
write!(w, r#"<span class="since" title="{}">{}</span>"#, title, stability);
|
write!(w, r#"<span class="since{extra_class}" title="{title}">{stability}</span>"#);
|
||||||
}
|
}
|
||||||
|
|
||||||
!stability.is_empty()
|
!stability.is_empty()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn render_stability_since_raw(
|
||||||
|
w: &mut Buffer,
|
||||||
|
ver: Option<Symbol>,
|
||||||
|
const_stability: Option<ConstStability>,
|
||||||
|
containing_ver: Option<Symbol>,
|
||||||
|
containing_const_ver: Option<Symbol>,
|
||||||
|
) -> bool {
|
||||||
|
render_stability_since_raw_with_extra(
|
||||||
|
w,
|
||||||
|
ver,
|
||||||
|
const_stability,
|
||||||
|
containing_ver,
|
||||||
|
containing_const_ver,
|
||||||
|
"",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fn render_assoc_item(
|
fn render_assoc_item(
|
||||||
w: &mut Buffer,
|
w: &mut Buffer,
|
||||||
item: &clean::Item,
|
item: &clean::Item,
|
||||||
@ -1675,25 +1694,29 @@ fn render_rightside(
|
|||||||
RenderMode::Normal => (item.const_stability(tcx), containing_item.const_stable_since(tcx)),
|
RenderMode::Normal => (item.const_stability(tcx), containing_item.const_stable_since(tcx)),
|
||||||
RenderMode::ForDeref { .. } => (None, None),
|
RenderMode::ForDeref { .. } => (None, None),
|
||||||
};
|
};
|
||||||
|
let src_href = cx.src_href(item);
|
||||||
|
let has_src_ref = src_href.is_some();
|
||||||
|
|
||||||
let mut rightside = Buffer::new();
|
let mut rightside = Buffer::new();
|
||||||
let has_stability = render_stability_since_raw(
|
let has_stability = render_stability_since_raw_with_extra(
|
||||||
&mut rightside,
|
&mut rightside,
|
||||||
item.stable_since(tcx),
|
item.stable_since(tcx),
|
||||||
const_stability,
|
const_stability,
|
||||||
containing_item.stable_since(tcx),
|
containing_item.stable_since(tcx),
|
||||||
const_stable_since,
|
const_stable_since,
|
||||||
|
if has_src_ref { "" } else { " rightside" },
|
||||||
);
|
);
|
||||||
let mut srclink = Buffer::empty_from(w);
|
if let Some(l) = src_href {
|
||||||
if let Some(l) = cx.src_href(item) {
|
if has_stability {
|
||||||
write!(srclink, "<a class=\"srclink\" href=\"{}\">source</a>", l)
|
write!(rightside, " · <a class=\"srclink\" href=\"{}\">source</a>", l)
|
||||||
|
} else {
|
||||||
|
write!(rightside, "<a class=\"srclink rightside\" href=\"{}\">source</a>", l)
|
||||||
}
|
}
|
||||||
if has_stability && !srclink.is_empty() {
|
|
||||||
rightside.write_str(" · ");
|
|
||||||
}
|
}
|
||||||
rightside.push_buffer(srclink);
|
if has_stability && has_src_ref {
|
||||||
if !rightside.is_empty() {
|
|
||||||
write!(w, "<span class=\"rightside\">{}</span>", rightside.into_inner());
|
write!(w, "<span class=\"rightside\">{}</span>", rightside.into_inner());
|
||||||
|
} else {
|
||||||
|
w.push_buffer(rightside);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ details.rustdoc-toggle > summary::before {
|
|||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rightside,
|
.rightside:not(a),
|
||||||
.out-of-band {
|
.out-of-band {
|
||||||
color: grey;
|
color: grey;
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ details.rustdoc-toggle > summary::before {
|
|||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rightside,
|
.rightside:not(a),
|
||||||
.out-of-band {
|
.out-of-band {
|
||||||
color: grey;
|
color: grey;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ details.rustdoc-toggle > summary::before {
|
|||||||
.stab { background: #FFF5D6; border-color: #FFC600; }
|
.stab { background: #FFF5D6; border-color: #FFC600; }
|
||||||
.stab.portability > code { background: none; }
|
.stab.portability > code { background: none; }
|
||||||
|
|
||||||
.rightside,
|
.rightside:not(a),
|
||||||
.out-of-band {
|
.out-of-band {
|
||||||
color: grey;
|
color: grey;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user