-
Notifications
You must be signed in to change notification settings - Fork 853
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
Do not break method chains until first method #3290
Comments
Given we're at 1.0 and therefore this would be a backwards incompatible change, we're unlikely to implement, sorry (it was also decided upon during the formatting RFC process and this formatting was not very controversial). |
@nrc I understand that it can't be default behavior, but making it an configurable option would be possible, no? |
I think the extra code complexity to do this for the fairly niche payoff would mean that it is not worth supporting this as an option, sorry |
@nrc Alright. I did notice an inconsistency though where if the first identifier is shorter than the indent, the first method is not properly put on it's own line. For example see how this toy code is formatted by rustfmt, making fn strip_whitespace(s: String) -> String {
s.chars()
.filter(|c| *c != ' ')
.filter(|c| *c != '\n')
.collect()
} vs fn strip_whitespace(string: String) -> String {
string
.chars()
.filter(|c| *c != ' ')
.filter(|c| *c != '\n')
.collect()
} Should I made a new issue for that? Or is that intended? |
It is intended, in order to avoid an ugly 'orphan line, e.g.,
|
Alright then. |
Perhaps I'm alone in this, but I'm often peeved by the way this gets formatted:
Would it be possible either by default, or with an configurable option to not start a method chain until the first actual method, assuming it fits on one line? That is the above would be:
Or with multiple dots before the first method:
Of course if the line would become too long the break should still happen:
The text was updated successfully, but these errors were encountered: