Skip to content

Commit d7891c7

Browse files
committed
rustdoc: Turn the noise down on implemented traits
This commit removes the inherited documentation from type pages. This generally just clutters up the page when you can click through to the trait itself to get all the meaty documentation. Closes #11991
1 parent 4d2877c commit d7891c7

File tree

1 file changed

+7
-37
lines changed

1 file changed

+7
-37
lines changed

src/librustdoc/html/render.rs

+7-37
Original file line numberDiff line numberDiff line change
@@ -1619,54 +1619,24 @@ fn render_impl(w: &mut Writer, i: &clean::Impl,
16191619
None => {}
16201620
}
16211621

1622-
fn docmeth(w: &mut Writer, item: &clean::Item) -> io::IoResult<bool> {
1622+
fn docmeth(w: &mut Writer, item: &clean::Item,
1623+
dox: bool) -> io::IoResult<()> {
16231624
try!(write!(w, "<h4 id='method.{}' class='method'><code>",
16241625
*item.name.get_ref()));
16251626
try!(render_method(w, item));
16261627
try!(write!(w, "</code></h4>\n"));
16271628
match item.doc_value() {
1628-
Some(s) => {
1629+
Some(s) if dox => {
16291630
try!(write!(w, "<div class='docblock'>{}</div>", Markdown(s)));
1630-
Ok(true)
1631+
Ok(())
16311632
}
1632-
None => Ok(false)
1633+
Some(..) | None => Ok(())
16331634
}
16341635
}
16351636

16361637
try!(write!(w, "<div class='methods'>"));
16371638
for meth in i.methods.iter() {
1638-
if try!(docmeth(w, meth)) {
1639-
continue
1640-
}
1641-
1642-
// No documentation? Attempt to slurp in the trait's documentation
1643-
let trait_id = match trait_id {
1644-
None => continue,
1645-
Some(id) => id,
1646-
};
1647-
try!(local_data::get(cache_key, |cache| {
1648-
let cache = cache.unwrap();
1649-
match cache.traits.find(&trait_id) {
1650-
Some(t) => {
1651-
let name = meth.name.clone();
1652-
match t.methods.iter().find(|t| t.item().name == name) {
1653-
Some(method) => {
1654-
match method.item().doc_value() {
1655-
Some(s) => {
1656-
try!(write!(w,
1657-
"<div class='docblock'>{}</div>",
1658-
Markdown(s)));
1659-
}
1660-
None => {}
1661-
}
1662-
}
1663-
None => {}
1664-
}
1665-
}
1666-
None => {}
1667-
}
1668-
Ok(())
1669-
}))
1639+
try!(docmeth(w, meth, true));
16701640
}
16711641

16721642
// If we've implemented a trait, then also emit documentation for all
@@ -1685,7 +1655,7 @@ fn render_impl(w: &mut Writer, i: &clean::Impl,
16851655
None => {}
16861656
}
16871657

1688-
try!(docmeth(w, method.item()));
1658+
try!(docmeth(w, method.item(), false));
16891659
}
16901660
}
16911661
None => {}

0 commit comments

Comments
 (0)