-
Notifications
You must be signed in to change notification settings - Fork 889
New issue
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
Format trailing where clauses in type aliases #5887
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
type Foo // comment1 | ||
// interlinear1 | ||
where // comment2 | ||
// interlinear2 | ||
A: B, // comment3 | ||
C: D, // comment4 | ||
// interlinear3 | ||
= E; // comment5 | ||
|
||
type Foo // comment6 | ||
// interlinear4 | ||
where// comment7 | ||
// interlinear5 | ||
A: B, // comment8 | ||
C: D, // comment9 | ||
// interlinear6 | ||
= E // comment10 | ||
// interlinear7 | ||
where // comment11 | ||
// interlinear8 | ||
F: G, // comment12 | ||
H: I; // comment13 | ||
|
||
type Foo // comment14 | ||
// interlinear9 | ||
= E // comment15 | ||
// interlinear10 | ||
where // comment16 | ||
// interlinear11 | ||
F: G,// comment17 | ||
H: I;// comment18 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
type Foo | ||
where | ||
A: B, | ||
C: D, | ||
= E; | ||
|
||
type Foo | ||
where | ||
A: B, | ||
C: D, | ||
= E | ||
where | ||
F: G, | ||
H: I; | ||
|
||
type Foo | ||
= E | ||
where | ||
F: G, | ||
H: I; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
type Foo | ||
// comment1 | ||
// interlinear1 | ||
where | ||
// comment2 | ||
// interlinear2 | ||
A: B, // comment3 | ||
C: D, // comment4 | ||
// interlinear3 | ||
= E; // comment5 | ||
|
||
type Foo | ||
// comment6 | ||
// interlinear4 | ||
where | ||
// comment7 | ||
// interlinear5 | ||
A: B, // comment8 | ||
C: D, // comment9 | ||
// interlinear6 | ||
= E | ||
// comment10 | ||
// interlinear7 | ||
where | ||
// comment11 | ||
// interlinear8 | ||
F: G, // comment12 | ||
H: I; // comment13 | ||
|
||
type Foo // comment14 | ||
// interlinear9 | ||
= E | ||
// comment15 | ||
// interlinear10 | ||
where | ||
// comment16 | ||
// interlinear11 | ||
F: G, // comment17 | ||
H: I; // comment18 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
type Foo | ||
where | ||
A: B, | ||
C: D, | ||
= E; | ||
|
||
type Foo | ||
where | ||
A: B, | ||
C: D, | ||
= E | ||
where | ||
F: G, | ||
H: I; | ||
|
||
type Foo | ||
= E | ||
where | ||
F: G, | ||
H: I; | ||
Comment on lines
+16
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @compiler-errors is there documentation in the style guide that you can link to for this? I'm wondering why this wouldn't be formatted like: type Foo = E
where
F: G,
H: I; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Specifically: When there is a trailing // With only a trailing where clause
type VeryLongType<T, U>
= AnEvenLongerType<T, U, Foo<T>>
where
T: U::AnAssociatedType,
U: SomeBound; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you. That's exactly what I was looking for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like an interesting case. Is it valid to have two where clauses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but it's not denied by the parser, so I think rustfmt shouldn't explode when we have it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate the clarification on this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to adopt this as a new motto for us 🤣