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
fncreate_app() -> App{letmut app = App::new("A program name").about("A program that does stuff to computers").arg(Arg::with_name("disable_foo_bar").long("disable-foo-bar").help("Disable all the foos in the bar. Prevents things from going all baz on you for example"));
app
}
Output
Nothing changes
Expected output
I expect the indentation of the .about(...), .long(...) and .help(...) as well as the final ); to be fixed. But they are not.
It all works as expected if the string passed to .help(....) is shorter.
fncreate_app() -> App{letmut app = App::new("A program name").about("A program that does stuff to computers").arg(Arg::with_name("disable_foo_bar").long("disable-foo-bar").help("Disable all the foos in the bar. Prevents things from going all baz on you for example"));
app
}
Meta
rustfmt version: Tested on both rustfmt 1.4.16-stable (939e164 2020-06-11) and rustfmt 2.0.0-rc.2-nightly (2c39e809 2020-07-10)
From where did you install rustfmt?: 1.4.16 via the default component via rustup. 2.0.0.-rc.2 from the git master branch today.
The text was updated successfully, but these errors were encountered:
Yeah this is a duplicate of several issues, all driven by rustfmt's current behavior wherein if any single chain item exceeds max_width then the entire chain is left unformatted.
The general consensus/desire seems to be to have rustfmt format the chain anyway (and just let the problematic item(s) exceed the width). I spent some time a while ago fighting this and had a semi-working fix though I was somewhat unhappy with my implementation attempt and dropped it 😄
Part of the challenge with carrying on with formatting the entire chain is dealing with certain combinations of indent_style and where the long item is within the chain. For example when indent_style is Visual and the long chain item is the parent or first item, you can end up with a formatted result that's far worse than the original.
Anyway, thanks for reporting this @faern but I'm going to close this given the dupe nature. Feel free to track #4183!
Input
Output
Nothing changes
Expected output
I expect the indentation of the
.about(...)
,.long(...)
and.help(...)
as well as the final);
to be fixed. But they are not.It all works as expected if the string passed to
.help(....)
is shorter.Meta
rustfmt 1.4.16-stable (939e164 2020-06-11)
andrustfmt 2.0.0-rc.2-nightly (2c39e809 2020-07-10)
The text was updated successfully, but these errors were encountered: