Remove unneeded trait implementations titles
This commit is contained in:
parent
dca14701a5
commit
d91a821ee8
2 changed files with 34 additions and 11 deletions
|
@ -2274,9 +2274,9 @@ fn render_implementor(cx: &Context, implementor: &Impl, w: &mut fmt::Formatter,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_impls(cx: &Context, w: &mut fmt::Formatter,
|
fn render_impls(cx: &Context, w: &mut fmt::Formatter,
|
||||||
traits: Vec<&&Impl>,
|
traits: &[&&Impl],
|
||||||
containing_item: &clean::Item) -> Result<(), fmt::Error> {
|
containing_item: &clean::Item) -> Result<(), fmt::Error> {
|
||||||
for i in &traits {
|
for i in traits {
|
||||||
let did = i.trait_did().unwrap();
|
let did = i.trait_did().unwrap();
|
||||||
let assoc_link = AssocItemLink::GotoSource(did, &i.inner_impl().provided_trait_methods);
|
let assoc_link = AssocItemLink::GotoSource(did, &i.inner_impl().provided_trait_methods);
|
||||||
render_impl(w, cx, i, assoc_link,
|
render_impl(w, cx, i, assoc_link,
|
||||||
|
@ -3172,14 +3172,22 @@ fn render_assoc_items(w: &mut fmt::Formatter,
|
||||||
.iter()
|
.iter()
|
||||||
.partition::<Vec<_>, _>(|t| t.inner_impl().synthetic);
|
.partition::<Vec<_>, _>(|t| t.inner_impl().synthetic);
|
||||||
|
|
||||||
write!(w, "
|
struct RendererStruct<'a, 'b, 'c>(&'a Context, Vec<&'b &'b Impl>, &'c clean::Item);
|
||||||
<h2 id='implementations' class='small-section-header'>
|
|
||||||
Trait Implementations<a href='#implementations' class='anchor'></a>
|
impl<'a, 'b, 'c> fmt::Display for RendererStruct<'a, 'b, 'c> {
|
||||||
</h2>
|
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||||
<div id='implementations-list'>
|
render_impls(self.0, fmt, &self.1, self.2)
|
||||||
")?;
|
}
|
||||||
render_impls(cx, w, concrete, containing_item)?;
|
}
|
||||||
write!(w, "</div>")?;
|
|
||||||
|
let impls = format!("{}", RendererStruct(cx, concrete, containing_item));
|
||||||
|
if !impls.is_empty() {
|
||||||
|
write!(w, "
|
||||||
|
<h2 id='implementations' class='small-section-header'>
|
||||||
|
Trait Implementations<a href='#implementations' class='anchor'></a>
|
||||||
|
</h2>
|
||||||
|
<div id='implementations-list'>{}</div>", impls)?;
|
||||||
|
}
|
||||||
|
|
||||||
if !synthetic.is_empty() {
|
if !synthetic.is_empty() {
|
||||||
write!(w, "
|
write!(w, "
|
||||||
|
@ -3188,7 +3196,7 @@ fn render_assoc_items(w: &mut fmt::Formatter,
|
||||||
</h2>
|
</h2>
|
||||||
<div id='synthetic-implementations-list'>
|
<div id='synthetic-implementations-list'>
|
||||||
")?;
|
")?;
|
||||||
render_impls(cx, w, synthetic, containing_item)?;
|
render_impls(cx, w, &synthetic, containing_item)?;
|
||||||
write!(w, "</div>")?;
|
write!(w, "</div>")?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
15
src/test/rustdoc/unneeded-trait-implementations-title.rs
Normal file
15
src/test/rustdoc/unneeded-trait-implementations-title.rs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
#![crate_name = "foo"]
|
||||||
|
|
||||||
|
pub struct Bar;
|
||||||
|
|
||||||
|
// @!has foo/struct.Bar.html '//*[@id="implementations"]'
|
Loading…
Add table
Add a link
Reference in a new issue