-
Notifications
You must be signed in to change notification settings - Fork 913
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
Trailing whitespace of match arm not stripped when the body expression is very long and follows in the second line #5689
Comments
Thanks for reaching out. There are 2 issues here. First, rustfmt is unable to format the The typical solution in these case is to increase the
As described by the error, rustfmt isn't expecting a comment between the fn this_is_a_very_long_name_to_lengthen_the_expression_so_that_rustfmt_does_not_join_the_lines() {} Inputfn main() {
match () {
_ => {/* (whitespace here) => */
this_is_a_very_long_name_to_lengthen_the_expression_so_that_rustfmt_does_not_join_the_lines()
}
}
} Output (using
|
The comment error described above is better illustrated by this example, which uses a short function name: fn main() {
match () {
_ => /* (whitespace here) => */
f(),
}
} When running rustfmt with
|
I'm seeing this error as well.
That's surprising to me. Edit: Oh, I see it does mention
Result:
Edit again: Oh never mind, it still fails with |
@mk12 could you post the actual code snippet where you're running into the warning. There are many different scenarios where In case your issue doesn't relate to comments between
Just to be clear It's only a bug if rustfmt is the one introducing trailing whitespace into the code |
Minimal reproducer:
Output:
The text was updated successfully, but these errors were encountered: