rust-lang/rustfmt

rustfmt eats attributes while formatting functions with variadic parameters

Open

#6.561 aberto em 11 de mai. de 2025

Ver no GitHub
 (3 comments) (0 reactions) (0 assignees)Rust (760 forks)batch import
C-buggood first issue

Métricas do repositório

Stars
 (4.893 stars)
Métricas de merge de PR
 (Mesclagem média 10d 21h) (8 fundiu PRs em 30d)

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

Guia do colaborador