Skip to content

mixed_attributes_style cannot be disabled globally #12436

@apoelstra

Description

@apoelstra

Summary

If the mixed_attributes_style lint is whitelisted in lib.rs/main.rs, but triggered in another file, it still triggers. The top-level whitelist appears to apply only to the top-level file, and inline modules within that file. Not modules which are different files.

Reproducer

I tried this code:

main.rs

#![allow(clippy::mixed_attributes_style)] // https://github.com/rust-lang/rust-clippy/issues/12435
mod submodule;
fn main() {}

submodule.rs

#[cfg(test)]
mod tests {
    //! Doccomment for my tests module
}

The lint triggers:

warning: item has both inner and outer attributes
 --> src/submodule.rs:1:1
  |
1 | / #[cfg(test)]
2 | | mod tests {
3 | |     //! Doccomment for my tests module
  | |______________________________________^
  |
  = 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

Version

rustc 1.73.0 (cc66ad468 2023-10-03)
binary: rustc
commit-hash: cc66ad468955717ab92600c770da8c1601a4ff33
commit-date: 2023-10-03
host: x86_64-unknown-linux-gnu
release: 1.73.0
LLVM version: 17.0.2

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions