RS.CLIPPY.MIXED_ATTRIBUTES_STYLE

Item has both inner and outer attributes

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: mixed_attributes_style. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for items that have the same kind of attributes with mixed styles (inner/outer).

Why is this bad?

Having both style of said attributes makes it more complicated to read code.

Known problems

This lint currently has false-negatives when mixing same attributes but they have different path symbols, for example:

#[custom_attribute]
pub fn foo() {
    #![my_crate::custom_attribute]
}

Example

#[cfg(linux)]
pub fn foo() {
    #![cfg(windows)]
}

Use instead:

#[cfg(linux)]
#[cfg(windows)]
pub fn foo() {
}