Open
Description
The styling of where-clauses on tuple & unit structs and on assoc tys weirdly differs from those on other items (structs, enums, unions, functions, impl blocks etc.) in that they don't have a smaller fonts size and are indented by 9 instead of 4 spaces (more precisely: for associated types it's 3 instead of 4 inside the .item-decl
of the trait but 9 instead of 4 everywhere else).
Tuple Structs
pub struct A<T>(T)
where
T: Copy;
is rendered as
Compare that to
pub struct B<T>
where
T: Copy,
{
x: T,
}
Unit Structs
#![feature(trivial_bounds)]
pub struct S
where
String: Clone;
Associated Types
pub struct S;
pub trait Tr {
type F<T>
where
T: Clone;
}
impl Tr for S {
type F<T> = T where T: Clone;
}
Inside the .item-decl
of the trait (3 spaces, big):
In section Required Associated Types on the page of the trait (9 spaces):
On the implementer's page (9 spaces, big):
@rustbot label C-bug T-rustdoc A-rustdoc-ui
Activity
where
clause styling #113043Further simplify `print_where_clause`
Add test for rust-lang#112901
GuillaumeGomez commentedon Jul 11, 2023
#112927 fixed all of them as far as I can see:
The remaining debate is about the 3 spaces rule which makes the reading easier but differs from rustfmt. You can see the debate in #113043.
fmease commentedon Jul 11, 2023
#112927 did indeed mostly fix it. The one thing remaining though is the font size of the where-clause which #113043 fixes: Outside of
.item-decl
I expect them to be smaller compared to the corresponding item.The where-clause being indented by 3 spaces inside of
.item-decl
s has been FCP'ed as notriddle reminded me, so that's set in stone until someone raises a serious concern.