diff options
| author | Urgau <urgau@numericable.fr> | 2022-09-21 19:01:49 +0200 |
|---|---|---|
| committer | Urgau <urgau@numericable.fr> | 2022-09-21 19:01:49 +0200 |
| commit | e214385a4d1933ddb6a4c6ffeed50c7228674656 (patch) | |
| tree | f397a87e58679c4b3a2e727cc92ae963ff5b6bec | |
| parent | b79b7d8b4e0f2b112142a9ce1fea335f321a6558 (diff) | |
| download | rust-e214385a4d1933ddb6a4c6ffeed50c7228674656.tar.gz rust-e214385a4d1933ddb6a4c6ffeed50c7228674656.zip | |
Add missing space between notable trait tooltip and where clause
| -rw-r--r-- | src/librustdoc/html/format.rs | 2 | ||||
| -rw-r--r-- | src/test/rustdoc/where.SWhere_TraitWhere_item-decl.html | 7 | ||||
| -rw-r--r-- | src/test/rustdoc/where.rs | 12 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index ec6b8c2469c..b499e186cc0 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -371,7 +371,7 @@ pub(crate) fn print_where_clause<'a, 'tcx: 'a>( format!("<br><span class=\"where\">where{where_preds}</span>") } else { let mut clause = br_with_padding; - clause.truncate(clause.len() - 5 * " ".len()); + clause.truncate(clause.len() - 4 * " ".len()); write!(clause, "<span class=\"where\">where{where_preds}</span>")?; clause } diff --git a/src/test/rustdoc/where.SWhere_TraitWhere_item-decl.html b/src/test/rustdoc/where.SWhere_TraitWhere_item-decl.html index 0fbdc0c9cd1..24ab77703d1 100644 --- a/src/test/rustdoc/where.SWhere_TraitWhere_item-decl.html +++ b/src/test/rustdoc/where.SWhere_TraitWhere_item-decl.html @@ -1,3 +1,8 @@ <div class="item-decl"><pre class="rust trait"><code>pub trait TraitWhere { - type <a href="#associatedtype.Item" class="associatedtype">Item</a><'a><br />   <span class="where">where<br />        Self: 'a</span>; + type <a href="#associatedtype.Item" class="associatedtype">Item</a><'a><br />    <span class="where">where<br />        Self: 'a</span>; + + fn <a href="#method.func" class="fnname">func</a>(self)<br />    <span class="where">where<br />        Self: <a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>, + { ... } +<span class="item-spacer" /> fn <a href="#method.lines" class="fnname">lines</a>(self) -> <a class="struct" href="{{channel}}/std/io/struct.Lines.html" title="struct std::io::Lines">Lines</a><Self><br />    <span class="where">where<br />        Self: <a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>, + { ... } }</code></pre></div> \ No newline at end of file diff --git a/src/test/rustdoc/where.rs b/src/test/rustdoc/where.rs index 8818d74ddd0..68a146bfa55 100644 --- a/src/test/rustdoc/where.rs +++ b/src/test/rustdoc/where.rs @@ -1,5 +1,7 @@ #![crate_name = "foo"] +use std::io::Lines; + pub trait MyTrait { fn dummy(&self) { } } // @has foo/struct.Alpha.html '//pre' "pub struct Alpha<A>(_)where A: MyTrait" @@ -29,6 +31,16 @@ where // @snapshot SWhere_TraitWhere_item-decl - '//div[@class="item-decl"]' pub trait TraitWhere { type Item<'a> where Self: 'a; + + fn func(self) + where + Self: Sized + {} + + fn lines(self) -> Lines<Self> + where + Self: Sized, + { todo!() } } // @has foo/struct.Echo.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ |
