From 35091620e6726b1f6262a2a3ae4575833fd994a9 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 28 May 2019 15:45:28 +0200 Subject: [PATCH] Don't generate div inside header (h4/h3/h...) elements --- src/librustdoc/html/render.rs | 2 +- src/test/rustdoc/trait-attributes.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index b628bd450d3..bb92d18a5fb 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -3804,7 +3804,7 @@ fn render_attributes(w: &mut dyn fmt::Write, it: &clean::Item, top: bool) -> fmt } } if attrs.len() > 0 { - write!(w, "
{}
", + write!(w, "{}", if top { " top-attr" } else { "" }, &attrs)?; } Ok(()) diff --git a/src/test/rustdoc/trait-attributes.rs b/src/test/rustdoc/trait-attributes.rs index 971e6b554cc..a6ee046edec 100644 --- a/src/test/rustdoc/trait-attributes.rs +++ b/src/test/rustdoc/trait-attributes.rs @@ -3,7 +3,7 @@ // ignore-tidy-linelength pub trait Foo { - // @has foo/trait.Foo.html '//h3[@id="tymethod.foo"]//div[@class="docblock attributes"]' '#[must_use]' + // @has foo/trait.Foo.html '//h3[@id="tymethod.foo"]//span[@class="docblock attributes"]' '#[must_use]' #[must_use] fn foo(); } @@ -12,11 +12,11 @@ pub trait Foo { pub struct Bar; impl Bar { - // @has foo/struct.Bar.html '//h4[@id="method.bar"]//div[@class="docblock attributes"]' '#[must_use]' + // @has foo/struct.Bar.html '//h4[@id="method.bar"]//span[@class="docblock attributes"]' '#[must_use]' #[must_use] pub fn bar() {} - // @has foo/struct.Bar.html '//h4[@id="method.bar2"]//div[@class="docblock attributes"]' '#[must_use]' + // @has foo/struct.Bar.html '//h4[@id="method.bar2"]//span[@class="docblock attributes"]' '#[must_use]' #[must_use] pub fn bar2() {} }