You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ rustfmt --config max_width=80,chain_width=73 --print-config current . | grep '\(\<max\|chain\)_width'
max_width = 80
chain_width = 73
$ rustfmt --config max_width=80,chain_width=73 --check src/lib.rs
`chain_width` cannot have a value that exceeds `max_width`. `chain_width` will be set to the same value as `max_width`
If I don't also override max_width, the warning occurs with chain_width >= 93 instead of 101 as expected; I checked several other max_widths as well, and it seems the highest chain_width accepted without warning is always 8 less than max_width.
If src/lib.rs doesn't contain a macro, e.g.:
fn f() {}
Then I get the warning (albeit twice) starting with a chain_width of one more than max_width as expected:
$ rustfmt --config max_width=80,chain_width=81 --print-config current . | grep '\(\<max\|chain\)_width'
`chain_width` cannot have a value that exceeds `max_width`. `chain_width` will be set to the same value as `max_width`
max_width = 80
chain_width = 80
$ rustfmt --config max_width=80,chain_width=81 --check src/lib.rs
`chain_width` cannot have a value that exceeds `max_width`. `chain_width` will be set to the same value as `max_width`
`chain_width` cannot have a value that exceeds `max_width`. `chain_width` will be set to the same value as `max_width`
Behavior is the same for array_width and struct_lit_width; I didn't check the rest of the width settings. Behavior is also the same on stable and nightly.
The correlation with the presence of a macro def is baffling since the evaluation of the config settings should be happening long before any parsing stages.
For anyone interested in taking a look at fixing this the comparison point that's emitting the warnings can be found here:
With the following
src/lib.rs
:rustfmt
seems to be getting incorrect width settings from somewhere:If I don't also override max_width, the warning occurs with chain_width >= 93 instead of 101 as expected; I checked several other max_widths as well, and it seems the highest chain_width accepted without warning is always 8 less than max_width.
If
src/lib.rs
doesn't contain a macro, e.g.:Then I get the warning (albeit twice) starting with a chain_width of one more than max_width as expected:
Behavior is the same for array_width and struct_lit_width; I didn't check the rest of the width settings. Behavior is also the same on stable and nightly.
Full config in case it's helpful (should all be defaults):
The text was updated successfully, but these errors were encountered: