We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trait Foo { type Bar; } impl Foo for () { // The following line doesn't get formatted. type Bar = () where u8: Copy; }
playground
Removing the where clause restores formatting, so this looks specific to where clause in associated types.
where
The text was updated successfully, but these errors were encountered:
@ia0 thanks for the report. Confirming I can reproduce this with rustfmt 1.5.2-nightly (4aacac8e 2023-04-09).
rustfmt 1.5.2-nightly (4aacac8e 2023-04-09)
The issue here might be that we haven't defined how to format associated types when the where clause comes after the type.
There doesn't seem to be anything defined in the Style Guide docs for Associated types. @calebcartwright is this something that needs to be brought to t-style's attention? Maybe the Style Guide docs should be brought closer in line with the Rust Reference Associated Types docs
t-style's
It looks like we can format the deprecated form:
deprecated form
Input
impl Foo for () { // The following line doesn't get formatted. type Bar = () where u8: Copy; // The following is formatted. type Baz where u8: Copy = (); }
Output
impl Foo for () { // The following line doesn't get formatted. type Bar = () where u8: Copy; type Baz where u8: Copy, = (); }
Sorry, something went wrong.
After looking into it I think this is a duplicate of #5580
I confirm. Feel free to close this issue as duplicate. I subscribed to the other one.
Thanks for confirming this is a duplicate
No branches or pull requests
playground
Removing the
where
clause restores formatting, so this looks specific to where clause in associated types.The text was updated successfully, but these errors were encountered: