rune-rs / rune

An embeddable dynamic programming language for Rust.
https://rune-rs.github.io
Apache License 2.0
1.7k stars 85 forks source link

Silly auto-formatting for chained method calls / builder pattern #750

Open VorpalBlade opened 1 month ago

VorpalBlade commented 1 month ago

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", "btrfs-scrub@.timer", package_managers.get("pacman").unwrap()).name("btrfs-scrub@-.timer").enable(cmds)?;

I would prefer something like:

systemd::Systemd::from_pkg("btrfs-progs",
                           "btrfs-scrub@.timer",
                           package_managers.get("pacman").unwrap())
    .name("btrfs-scrub@-.timer")
    .enable(cmds)?;
VorpalBlade commented 1 month ago

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.