rustdoc: render the assoc ty body before the where-clause

This commit is contained in:
León Orell Valerian Liehr 2023-06-21 21:53:55 +02:00
parent f90d57d06e
commit b866113d19
No known key found for this signature in database
GPG Key ID: D17A07215F68E713
2 changed files with 4 additions and 3 deletions

View File

@ -800,10 +800,11 @@ fn assoc_type(
if !bounds.is_empty() {
write!(w, ": {}", print_generic_bounds(bounds, cx))
}
write!(w, "{}", print_where_clause(generics, cx, indent, Ending::NoNewline));
// Render the default before the where-clause which aligns with the new recommended style. See #89122.
if let Some(default) = default {
write!(w, " = {}", default.print(cx))
}
write!(w, "{}", print_where_clause(generics, cx, indent, Ending::NoNewline));
}
fn assoc_method(

View File

@ -23,9 +23,9 @@ fn next<'a>(&self) -> () {}
pub struct Infinite<T>(T);
// @has foo/trait.LendingIterator.html
// @has - '//*[@id="associatedtype.Item-2"]//h4[@class="code-header"]' "type Item<'a> where Self: 'a = &'a T"
// @has - '//*[@id="associatedtype.Item-2"]//h4[@class="code-header"]' "type Item<'a> = &'a T where Self: 'a"
impl<T> LendingIterator for Infinite<T> {
type Item<'a> where Self: 'a = &'a T;
type Item<'a> = &'a T where Self: 'a;
fn next<'a>(&'a self) -> Self::Item<'a> {
&self.0