rune-rs / rune

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

Formatting jank with comments at the trailing position in lists #801

Closed VorpalBlade closed 2 months ago

VorpalBlade commented 2 months ago
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 74c5ef79689c2d0db7c1a2f44b62dcbcac736298

udoprog commented 2 months ago

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