Skip to content

rustfmt eats attributes while formatting functions with variadic parameters #6561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mejrs opened this issue May 11, 2025 · 0 comments
Open

Comments

@mejrs
Copy link

mejrs commented May 11, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant