, _>(|t| t.inner_impl().synthetic);
- write!(w, "
-
-
- ")?;
- render_impls(cx, w, concrete, containing_item)?;
- write!(w, "
")?;
+ struct RendererStruct<'a, 'b, 'c>(&'a Context, Vec<&'b &'b Impl>, &'c clean::Item);
+
+ impl<'a, 'b, 'c> fmt::Display for RendererStruct<'a, 'b, 'c> {
+ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ render_impls(self.0, fmt, &self.1, self.2)
+ }
+ }
+
+ let impls = format!("{}", RendererStruct(cx, concrete, containing_item));
+ if !impls.is_empty() {
+ write!(w, "
+
+ {}
", impls)?;
+ }
if !synthetic.is_empty() {
write!(w, "
@@ -3188,7 +3196,7 @@ fn render_assoc_items(w: &mut fmt::Formatter,
")?;
- render_impls(cx, w, synthetic, containing_item)?;
+ render_impls(cx, w, &synthetic, containing_item)?;
write!(w, "
")?;
}
}
diff --git a/src/test/rustdoc/unneeded-trait-implementations-title.rs b/src/test/rustdoc/unneeded-trait-implementations-title.rs
new file mode 100644
index 0000000000000..2c074179e32b5
--- /dev/null
+++ b/src/test/rustdoc/unneeded-trait-implementations-title.rs
@@ -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 or the MIT license
+// , 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"]'