rust-lang/rustfmt

rustfmt eats attributes while formatting functions with variadic parameters

已关闭

#6,561 创建于 2025年5月11日

 (4 条评论) (0 个反应) (0 位负责人)Rust (760 个派生)batch import
C-buggood first issue

仓库指标

星标
 (4,893 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南