Skip to content
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

[mixed_attributes_style] should only lint when mixing the same attribute #12530

Closed
J-ZhengLi opened this issue Mar 22, 2024 · 0 comments · Fixed by #12486
Closed

[mixed_attributes_style] should only lint when mixing the same attribute #12530

J-ZhengLi opened this issue Mar 22, 2024 · 0 comments · Fixed by #12486
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@J-ZhengLi
Copy link
Member

J-ZhengLi commented Mar 22, 2024

Summary

related discussions:

Lint Name

mixed_attributes_style

Reproducer

I tried this code:

#[cfg(test)]
mod tests {
    #![allow(dead_code)]
}

I saw this happen:

warning: item has both inner and outer attributes
 --> src/lib.rs:1:1
  |
1 | / #[cfg(test)]
2 | | mod tests {
3 | |     #![allow(dead_code)]
  | |________________________^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mixed_attributes_style
  = note: `#[warn(clippy::mixed_attributes_style)]` on by default

I expected to see this happen:

no warnings, this is a common syntax, doesn't affect readability.

Version

on playground:

Nightly channel
Build using the Nightly version: 1.79.0-nightly

(2024-03-20 1388d7a069d872bcfe5e)

Additional Labels

No response

@J-ZhengLi J-ZhengLi added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Mar 22, 2024
@bors bors closed this as completed in db41621 Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant