rust-lang/rustfmt
在 GitHub 查看rustfmt eats attributes while formatting functions with variadic parameters
Open
#6,561 建立於 2025年5月11日
C-buggood first issue
倉庫指標
- Star
- (4,893 star)
- PR 合併指標
- (平均合併 67天) (30 天內合併 5 個 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