-
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
Compressed chains/fn calls #4146
Comments
Hi @TheBlueMatt If you haven't already done so, you may want to checkout the available Configuration options (for example rustfmt's default behavior is to format code according to the Rust Style Guide as defined over in https://github.com/rust-dev-tools/fmt-rfcs, though in many instances there are config options that can be used to override those defaults. |
Right, essentially what I’d love to see is the Compressed option (or something like it) from fn_args_layout available for chains/fn calls. Correct me if I’m wrong, but there appears to be nothing available which doesn’t jump to “vertical” for most things if a line runs long, which can lead to incredibly tall code in some projects.
… On Apr 29, 2020, at 20:25, Caleb Cartwright ***@***.***> wrote:
Hi @TheBlueMatt
If you haven't already done so, you may want to checkout the available Configuration options (for example fn_args_layout) to see if there's anything that allows you to tune the emitted formatting to your liking.
rustfmt's default behavior is to format code according to the Rust Style Guide as defined over in https://github.com/rust-dev-tools/fmt-rfcs, though in many instances there are config options that can be used to override those defaults.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
AFAIK there's no such equivalent config option that's used for the layout of call args. There was I believe the same challenges with a The relevant thread in the Style Guide can be found in rust-lang/style-team#65, also a previous request for Compressed call args in #2851 |
Yea, I'd come across #2010, but its quite old at this point, and the discussion there seemed both stale (ie was at a different time in rustfmt's history) and to not actually describe why it was closed. I get that it would be hard to do Compressed in a general way, but given that it comes up from time to time, may be best to at least track it as a relatively-common feature request. Its probably a blocker for us using rustfmt given how easily rustfmt makes code really tall breaks readability as-is. |
This sounds like a nice feature! |
This may be hard to get right, but, in general, I tend to prefer putting two or three things in a fn call instead of putting each on its own line. This prevents things from getting needlessly absurdly vertical, eg this in today's rustfmt:
could be
The text was updated successfully, but these errors were encountered: