-
Notifications
You must be signed in to change notification settings - Fork 927
Nested blocks and functions get weird visual indent #1570
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
Comments
I have encountered the same problem, which messes up the whole file!! |
This looks pretty bad with the RFC formatting too:
There should be some elision of line breaks, but once we multi-line the second arg of the nested function, it should put the args on different lines. |
Which is expected when using RFC? fn example() {
a_very_long_function_name({some_func(1, {
1
})})
} fn example() {
a_very_long_function_name({
some_func(1, {
1
})
})
} fn example() {
a_very_long_function_name({
some_func(
1,
{
1
},
)
})
} |
I would expect both the blocks to be single-line because they are single-expression blocks, so I'd probably expect:
If the inner block were not, then I would expect your first example (because everything nests and in the two arg case, we keep the last arg on the same line as the prefix args). However, I would expect a space after the opening |
@nrc Thank you for clarifying! |
Closed via #1729. |
Uh oh!
There was an error while loading. Please reload this page.
I honestly don't know how to describe that one. It's like rustfmt cannot decide whether it wants to include alignment with a block to indent. Default settings (like on play.rust-lang.org).
This:
Changes into this:
The text was updated successfully, but these errors were encountered: