-
Notifications
You must be signed in to change notification settings - Fork 898
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
Fixed Issue 'Trailing comma is duplicated when obstructed by comments' #4520
Conversation
tests/target/issue-3876.rs
Outdated
fn f<S>(s: S) | ||
where | ||
S: Send /* */, | ||
// | ||
{ | ||
} | ||
|
||
fn main() { | ||
foo( | ||
x // comment 1 | ||
, | ||
// comment 2 | ||
) | ||
} |
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 is a slight improvement in that the commas are not duplicated, though the formatting doesn't feel quite right. In particular I'm confused by the indentation/alignment in the first snippet, as well as the position of the ,
in the second.
I think a big question is whether there's a valid use case for comments before the comma, or whether that's just unintentional i.e.:
fn main() {
foo(
x, // comment 1
// comment 2
)
}
// or
fn main() {
foo(
x,
// comment 1
// comment 2
)
}
although at the moment I suspect rustfmt may want to do this, though that's largely due to a bug in default visual alignment for comments (refs #4108)
fn main() {
foo(
x, // comment 1
// comment 2
)
}
Sorry I was away from open source in last months. @calebcartwright Can you review again? |
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.
Thanks for this! It's in pretty good shape though think we can optimize it a bit and have also requested some additional tests
Excellent thank you! |
Fixes #3876 .