Skip to content

remove stray comma from cfg-attr allow() #3228

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
matthiaskrgr opened this issue Dec 3, 2018 · 2 comments
Open

remove stray comma from cfg-attr allow() #3228

matthiaskrgr opened this issue Dec 3, 2018 · 2 comments
Labels

Comments

@matthiaskrgr
Copy link
Member

#![cfg_attr(feature = "cargo-clippy", allow(clippy::inline_always,)]
could be formatted to #![cfg_attr(feature = "cargo-clippy", allow(clippy::inline_always)].

Note that this already works for just #![allow(nline_always,)]

rustfmt 1.0.0-nightly (43206f4 2018-11-30)

@ytmimi
Copy link
Contributor

ytmimi commented Jul 19, 2022

Confirming I can reproduce with rustfmt 1.5.1-nightly (b22884f7 2022-07-19)

input

#![cfg_attr(feature = "cargo-clippy", allow(clippy::inline_always,))]
#![allow(nline_always,)]

output

#![cfg_attr(feature = "cargo-clippy", allow(clippy::inline_always,))]
#![allow(nline_always)]

@ytmimi
Copy link
Contributor

ytmimi commented Jul 19, 2022

I understand that this isn't the intended result from this issue, but we don't want to remove trailing commas if they are present in the source text. The current behavior in the #![allow(nline_always,)] case is a bug. I just checked and #5394 resolves removing the trailing comma in the #![allow(nline_always,)]

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

No branches or pull requests

4 participants