-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
allow(clippy::duplicated_attributes)
does not take effect across out-of-line modules
#12538
Comments
@GuillaumeGomez @blyxyas (the lint is new from #12378) |
…y bug There is already #![allow(clippy::duplicated_attributes)] at the crate root, but clippy isn't applying it correctly inside this module. rust-lang/rust-clippy#12538
we should also probably add a comment here saying that you should prefer adding the lint to rust-clippy/clippy_lints/src/attrs/mod.rs Line 588 in 4a8c949
|
rust-lang/rust-clippy#12537 rust-lang/rust-clippy#12538 ``` error: duplicated attribute --> src\imp\mod.rs:168:21 | 168 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), | ^^^^^^^^^^^^^^^^^^^^^^ | note: first defined here --> src\imp\mod.rs:164:21 | 164 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), | ^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute --> src\imp\mod.rs:168:21 | 168 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), | ^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes = note: `-D clippy::duplicated-attributes` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::duplicated_attributes)]` error: duplicated attribute --> src\imp\mod.rs:168:46 | 168 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first defined here --> src\imp\mod.rs:164:46 | 164 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute --> src\imp\mod.rs:168:46 | 168 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes error: duplicated attribute --> src\imp\mod.rs:179:36 | 179 | all(target_arch = "s390x", portable_atomic_unstable_asm_experimental_arch), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first defined here --> src\imp\mod.rs:173:13 | 173 | portable_atomic_unstable_asm_experimental_arch, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute --> src\imp\mod.rs:179:36 | 179 | all(target_arch = "s390x", portable_atomic_unstable_asm_experimental_arch), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes error: duplicated attribute --> src\imp\mod.rs:205:5 | 205 | target_arch = "avr", | ^^^^^^^^^^^^^^^^^^^ | note: first defined here --> src\imp\mod.rs:195:5 | 195 | target_arch = "avr", | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute --> src\imp\mod.rs:205:5 | 205 | target_arch = "avr", | ^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes error: duplicated attribute --> src\imp\mod.rs:206:5 | 206 | target_arch = "msp430", | ^^^^^^^^^^^^^^^^^^^^^^ | note: first defined here --> src\imp\mod.rs:196:5 | 196 | target_arch = "msp430", | ^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute --> src\imp\mod.rs:206:5 | 206 | target_arch = "msp430", | ^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes error: duplicated attribute --> src\imp\mod.rs:210:5 | 210 | feature = "critical-section", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first defined here --> src\imp\mod.rs:194:5 | 194 | feature = "critical-section", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute --> src\imp\mod.rs:210:5 | 210 | feature = "critical-section", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes ```
rust-lang/rust-clippy#12537 rust-lang/rust-clippy#12538 ``` error: duplicated attribute --> src\imp\mod.rs:168:21 | 168 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), | ^^^^^^^^^^^^^^^^^^^^^^ | note: first defined here --> src\imp\mod.rs:164:21 | 164 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), | ^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute --> src\imp\mod.rs:168:21 | 168 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), | ^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes = note: `-D clippy::duplicated-attributes` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::duplicated_attributes)]` error: duplicated attribute --> src\imp\mod.rs:168:46 | 168 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first defined here --> src\imp\mod.rs:164:46 | 164 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute --> src\imp\mod.rs:168:46 | 168 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes error: duplicated attribute --> src\imp\mod.rs:179:36 | 179 | all(target_arch = "s390x", portable_atomic_unstable_asm_experimental_arch), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first defined here --> src\imp\mod.rs:173:13 | 173 | portable_atomic_unstable_asm_experimental_arch, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute --> src\imp\mod.rs:179:36 | 179 | all(target_arch = "s390x", portable_atomic_unstable_asm_experimental_arch), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes error: duplicated attribute --> src\imp\mod.rs:205:5 | 205 | target_arch = "avr", | ^^^^^^^^^^^^^^^^^^^ | note: first defined here --> src\imp\mod.rs:195:5 | 195 | target_arch = "avr", | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute --> src\imp\mod.rs:205:5 | 205 | target_arch = "avr", | ^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes error: duplicated attribute --> src\imp\mod.rs:206:5 | 206 | target_arch = "msp430", | ^^^^^^^^^^^^^^^^^^^^^^ | note: first defined here --> src\imp\mod.rs:196:5 | 196 | target_arch = "msp430", | ^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute --> src\imp\mod.rs:206:5 | 206 | target_arch = "msp430", | ^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes error: duplicated attribute --> src\imp\mod.rs:210:5 | 210 | feature = "critical-section", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first defined here --> src\imp\mod.rs:194:5 | 194 | feature = "critical-section", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute --> src\imp\mod.rs:210:5 | 210 | feature = "critical-section", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes ```
rust-lang/rust-clippy#12537 rust-lang/rust-clippy#12538 ``` error: duplicated attribute --> src\imp\mod.rs:168:21 | 168 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), | ^^^^^^^^^^^^^^^^^^^^^^ | note: first defined here --> src\imp\mod.rs:164:21 | 164 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), | ^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute --> src\imp\mod.rs:168:21 | 168 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), | ^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes = note: `-D clippy::duplicated-attributes` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::duplicated_attributes)]` error: duplicated attribute --> src\imp\mod.rs:168:46 | 168 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first defined here --> src\imp\mod.rs:164:46 | 164 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute --> src\imp\mod.rs:168:46 | 168 | any(not(portable_atomic_no_asm), portable_atomic_unstable_asm), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes error: duplicated attribute --> src\imp\mod.rs:179:36 | 179 | all(target_arch = "s390x", portable_atomic_unstable_asm_experimental_arch), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first defined here --> src\imp\mod.rs:173:13 | 173 | portable_atomic_unstable_asm_experimental_arch, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute --> src\imp\mod.rs:179:36 | 179 | all(target_arch = "s390x", portable_atomic_unstable_asm_experimental_arch), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes error: duplicated attribute --> src\imp\mod.rs:205:5 | 205 | target_arch = "avr", | ^^^^^^^^^^^^^^^^^^^ | note: first defined here --> src\imp\mod.rs:195:5 | 195 | target_arch = "avr", | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute --> src\imp\mod.rs:205:5 | 205 | target_arch = "avr", | ^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes error: duplicated attribute --> src\imp\mod.rs:206:5 | 206 | target_arch = "msp430", | ^^^^^^^^^^^^^^^^^^^^^^ | note: first defined here --> src\imp\mod.rs:196:5 | 196 | target_arch = "msp430", | ^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute --> src\imp\mod.rs:206:5 | 206 | target_arch = "msp430", | ^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes error: duplicated attribute --> src\imp\mod.rs:210:5 | 210 | feature = "critical-section", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first defined here --> src\imp\mod.rs:194:5 | 194 | feature = "critical-section", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute --> src\imp\mod.rs:210:5 | 210 | feature = "critical-section", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes ```
fixed, this is no longer a pre-expansion lint after some recent changes of mine for the attribute rework (@y21) |
Using |
Summary
For this particular lint, module-level
#![allow(clippy::duplicated_attributes)]
suppresses occurrences of the lint within that module, and within in-line modules in the same file, but not in modules from other files.This behavior is unlike what happens with
allow
for all other clippy lints, in which it applies to the whole module hierarchy across files.Reproducer
The occurrence within
mod here
is suppressed by theallow
but the one withinmod there
is not.Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: