rune icon indicating copy to clipboard operation
rune copied to clipboard

Silly auto-formatting for chained method calls / builder pattern

Open VorpalBlade opened this issue 1 year ago • 1 comments

When you have chained method calls / builder pattern the Rune auto-formatter wants to put it all on one line. It would be better if it formatted this like rustfmt split over several:

systemd::Systemd::from_pkg("btrfs-progs", "[email protected]", package_managers.get("pacman").unwrap()).name("[email protected]").enable(cmds)?;

I would prefer something like:

systemd::Systemd::from_pkg("btrfs-progs",
                           "[email protected]",
                           package_managers.get("pacman").unwrap())
    .name("[email protected]")
    .enable(cmds)?;

VorpalBlade avatar Jul 17 '24 12:07 VorpalBlade

You can also get this to happen with a long vector passed as an argument to a function. It seems that rune only inserts line breaks between statements, never breaking overly long lines.

VorpalBlade avatar Jul 18 '24 18:07 VorpalBlade