Closed 0hDEADBEAF closed 2 weeks ago
@0hDEADBEAF thanks for reaching out. I can totally understand the confusion, and I think it might be helpful to improve the documentation around use_small_heuristics=Off
.
Setting use_small_heuristics=Off
disables the width settings by setting chain_width
to usize::Max
, and that's why the chain doesn't get wrapped.
However, when you explicitly set chain_width=60
, that overrides the use of use_small_heuristics=Off
for the chain_width
setting.
Oh ok! Makes sense now, thank you :D
I've experienced an odd behavior with
rustfmt
parameterchain_width
. I'm using the followingrustfmt.toml
file:When invoking the command
cargo fmt
on the following code:Then the line
Foo::new("Hello world! This is just a loooooooong string.").test1().test2();
doesn't get changed.However, if I add
chain_width = 60
to therustfmt.toml
file and invokecargo fmt
again, the line gets modified to:This is odd to me since, according to the documentation (see here),
60
is the default value for the parameterchain_width
. So I was expecting to get the same result but that's not the case. Am I missing something? Is the documentation updated?From my quick investigation, I narrowed down the problem to what seems a conflict between the parameters
use_small_heuristics
andchain_width
. When I comment out the lineuse_small_heuristics = "Off"
in myrustfmt.toml
file, explicitely setting thechain_width
value to60
or not specifying it at all gives the same result, which seems to me like a normal behavior.This happens whether I'm using
cargo fmt
andcargo +nightly fmt
. I have the followingrustfmt
versions: