Skip to content

use_small_heuristics = false gives a mix of zero width and max width settings #2299

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

Closed
philipc opened this issue Dec 21, 2017 · 5 comments
Closed
Labels
only-with-option requires a non-default option value to reproduce

Comments

@philipc
Copy link
Contributor

philipc commented Dec 21, 2017

Previously I was using the individual width settings to stop rustfmt from splitting things across multiple lines at less than 100 characters width. This was changed for #1984. I'm fine with having a single setting to configure all of this, but the problem is that WidthHeuristics::null() specifies max width for half the settings, and 0 width for the others, which doesn't make much sense to me, because it means some things are put on a single line, and others are always split over multiple lines, whereas my goal is to stop needlessly splitting lines. Can we have an intermediate setting that only sets the max width values, and leaves the others at default width?

Also related, rustfmt --config-help documents width_heuristics, and you can set it in the config without any warnings about unknown settings, but the values have no effect.

@nrc nrc added the only-with-option requires a non-default option value to reproduce label Dec 21, 2017
@nrc
Copy link
Member

nrc commented Dec 21, 2017

The motivation for 0 vs max width is that for each heuristic, the effect is that the heuristic is turned off. If that is not the case, then there is a bug we should fix. So setting use_small_heuristics to false should give you what you want. Is that not the case?

@philipc
Copy link
Contributor Author

philipc commented Dec 21, 2017

It does turn the heuristics off, but there's two classes of heuristics:

  • those where normally the line would be longer, but we use heuristics to break earlier
  • those where normally it would be on separate lines, but we use heuristics to put it all on one line

I want an option to only disable heuristics for the first class.

@radix
Copy link
Contributor

radix commented Feb 15, 2018

@philipc Hi, can you take a look at #2437 and #2447? Would you use the proposed idea in those?

@philipc
Copy link
Contributor Author

philipc commented Feb 15, 2018

@radix That's now cramming long if statements and structs on one line, so I'd probably go with the default heuristics still.

@nrc
Copy link
Member

nrc commented Jun 24, 2018

This is basically a dup of #2437. We've also changed the values to off and default which I hope is clearer

@nrc nrc closed this as completed Jun 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
only-with-option requires a non-default option value to reproduce
Projects
None yet
Development

No branches or pull requests

3 participants