Display empty impl blocks if they have documentations
This commit is contained in:
parent
d35d972e69
commit
5881fd5c95
5 changed files with 14 additions and 3 deletions
|
@ -1600,6 +1600,13 @@ fn render_impl(
|
|||
}
|
||||
|
||||
if let Some(ref dox) = i.impl_item.collapsed_doc_value() {
|
||||
if trait_.is_none() && i.inner_impl().items.is_empty() {
|
||||
w.write_str(
|
||||
"<div class=\"item-info\">\
|
||||
<div class=\"stab empty-impl\">This impl block contains no items.</div>
|
||||
</div>",
|
||||
);
|
||||
}
|
||||
write!(
|
||||
w,
|
||||
"<div class=\"docblock\">{}</div>",
|
||||
|
|
|
@ -283,7 +283,8 @@ details.undocumented > summary::before {
|
|||
|
||||
.stab.unstable,
|
||||
.stab.deprecated,
|
||||
.stab.portability {
|
||||
.stab.portability,
|
||||
.stab.empty-impl {
|
||||
color: #c5c5c5;
|
||||
background: #314559 !important;
|
||||
border-style: none !important;
|
||||
|
|
|
@ -266,6 +266,7 @@ details.undocumented > summary::before {
|
|||
color: #ddd;
|
||||
}
|
||||
|
||||
.stab.empty-impl { background: #FFF5D6; border-color: #FFC600; color: #2f2f2f; }
|
||||
.stab.unstable { background: #FFF5D6; border-color: #FFC600; color: #2f2f2f; }
|
||||
.stab.deprecated { background: #ffc4c4; border-color: #db7b7b; color: #2f2f2f; }
|
||||
.stab.portability { background: #F3DFFF; border-color: #b07bdb; color: #2f2f2f; }
|
||||
|
|
|
@ -255,6 +255,7 @@ details.undocumented > summary::before {
|
|||
color: #000;
|
||||
}
|
||||
|
||||
.stab.empty-impl { background: #FFF5D6; border-color: #FFC600; }
|
||||
.stab.unstable { background: #FFF5D6; border-color: #FFC600; }
|
||||
.stab.deprecated { background: #ffc4c4; border-color: #db7b7b; }
|
||||
.stab.portability { background: #F3DFFF; border-color: #b07bdb; }
|
||||
|
|
|
@ -124,8 +124,9 @@ pub(crate) struct ImplStripper<'a> {
|
|||
impl<'a> DocFolder for ImplStripper<'a> {
|
||||
fn fold_item(&mut self, i: Item) -> Option<Item> {
|
||||
if let clean::ImplItem(ref imp) = *i.kind {
|
||||
// emptied none trait impls can be stripped
|
||||
if imp.trait_.is_none() && imp.items.is_empty() {
|
||||
// Impl blocks can be skipped if they are: empty; not a trait impl; and have no
|
||||
// documentation.
|
||||
if imp.trait_.is_none() && imp.items.is_empty() && i.doc_value().is_none() {
|
||||
return None;
|
||||
}
|
||||
if let Some(did) = imp.for_.def_id(self.cache) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue