rune-rs/rune

Formatting jank with comments at the trailing position in lists

Closed this issue · 1 comments

const DOVECOT_UNCHANGED = [
    //("dovecot-core", "dovecot-db.conf.ext"),
    ("dovecot-core", "dovecot-dict-auth.conf.ext"),
    ("dovecot-core", "dovecot-dict-sql.conf.ext"),
    ("dovecot-core", "dovecot-sql.conf.ext"),
    //("dovecot-core", "dovecot.conf"),
];

becomes

const DOVECOT_UNCHANGED = [
    //("dovecot-core", "dovecot-db.conf.ext"),
    ("dovecot-core", "dovecot-dict-auth.conf.ext"),
    ("dovecot-core", "dovecot-dict-sql.conf.ext"),
    ("dovecot-core", "dovecot-sql.conf.ext"),
];
//("dovecot-core", "dovecot.conf"),

The same thing happens with the comment in this:

    patch_file(
        ctx,
        "systemd-resolved",
        "/etc/systemd/resolved.conf",
        [
            (Selector::Regex("^#DNS="), Action::RegexReplace("#DNS=", "DNS=127.0.0.1")),
            (Selector::Regex("^#FallbackDNS="), Action::RegexReplace(
                "#FallbackDNS=",
                "FallbackDNS=1.1.1.1#cloudflare-dns.com 1.0.0.1#cloudflare-dns.com 2606:4700:4700::1111#cloudflare-dns.com 2606:4700:4700::1001#cloudflare-dns.com",
            )),
            (Selector::All, Action::RegexReplace("^#Domains=", `Domains=${fdqn} ~.`)),
            (Selector::All, Action::RegexReplace("^#(LLMNR|MulticastDNS)=yes", "$1=no")),
            // Don't enable DNSSEC, let unbound that we are chaining to handle it, systemd-resolved is not good at it
        ],
    )?;
    // The above comment gets moved down here!

I'm om commit 74c5ef7

Hi! Seems like we're missing a line comment hint right before this line: https://github.com/rune-rs/rune/blob/main/crates%2Frune%2Fsrc%2Ffmt%2Fformat.rs#L807