rust-lang/rustfmt

rustfmt eats attributes while formatting functions with variadic parameters

Open

#6.561 geöffnet am 11. Mai 2025

Auf GitHub ansehen
 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Rust (760 Forks)batch import
C-buggood first issue

Repository-Metriken

Stars
 (4.893 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 10T 21h) (8 gemergte PRs in 30 T)

Beschreibung

If you format...

#[allow()]
unsafe extern "C" {
    #[allow()]
    pub fn foo(#[allow()] arg: *mut u8, #[allow()]...);
}

Then it will format into

#[allow()]
unsafe extern "C" {
    #[allow()]
    pub fn foo(#[allow()] arg: *mut u8, ...);
}

(The choice of attribute seems irrelevant, I've used allow because it compiles in any position).

Note that this position is explicitly documented at https://doc.rust-lang.org/nightly/reference/attributes.html#r-attributes.allowed-position

Contributor Guide