RS.CLIPPY.DEPRECATED_CFG_ATTR

Usage of `cfg_attr(rustfmt)` instead of tool 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: deprecated_cfg_attr. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for #[cfg_attr(rustfmt, rustfmt_skip)] and suggests to replace it with #[rustfmt::skip].

Why is this bad?

Since tool_attributes (rust-lang/rust#44690) are stable now, they should be used instead of the old cfg_attr(rustfmt) attributes.

Known problems

This lint doesn't detect crate level inner attributes, because they get processed before the PreExpansionPass lints get executed. See #3123

Example

#[cfg_attr(rustfmt, rustfmt_skip)]
fn main() { }

Use instead:

#[rustfmt::skip]
fn main() { }

Configuration

  • msrv: The minimum rust version that the project supports. Defaults to the rust-version field in Cargo.toml

    (default: current version)