-
Notifications
You must be signed in to change notification settings - Fork 888
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
if-let guard formatting #4955
Comments
Thanks for the report. For anyone that takes a pass at working on this, please note that the length isn't an issue; the root issue i's a complete lack of handling the construct in the AST nodes. |
I understand that this issue is blocked on deciding how these should be formatted. However, the main problem for me rn is that when I use an if-let guard, the whole body of the arm stays unformatted (tried with whichever rustfmt is run with Whaveter the final style decision for how to format the |
That's an incorrect assumption. The nature of the arm pattern and guard formatting directly influence how the body is formatted, as dictated by the Style Guide. It's unfortunate from an end user perspective, but there's various cases where if rustfmt cannot format some sub part of an AST node, then it results in it not being able to format the entire AST node itself.
No. But formatting support for let expressions isn't too terribly far off |
Closing as support for this was added in #5910 On the latest rustfmt master we now format the input: input: fn main() {
match foo {
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa if let Some(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) = ccccccccccccccccccccccccccccccccccccccccccccccccc => {}
}
} output: fn main() {
match foo {
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
if let Some(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) =
ccccccccccccccccccccccccccccccccccccccccccccccccc => {}
}
} |
if let
guard formatting seems to be unsupported in rustfmt:cc rust-lang/rfcs#2294 rust-lang/rust#51114
The text was updated successfully, but these errors were encountered: