rust-lang/rustfmt

rustfmt eats attributes while formatting functions with variadic parameters

Fermée

#6 561 ouverte le 11 mai 2025

 (4 commentaires) (0 réaction) (0 personne assignée)Rust (760 forks)batch import
C-buggood first issue

Métriques du dépôt

Stars
 (4 893 étoiles)
Métriques de merge PR
 (Merge moyen 67j) (5 PRs mergées en 30 j)

Description

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

Guide contributeur