#17783·rust-clippy

`clippy::useless_attribute` incorrectly flags `clippy::allow_attributes` on `use` (itself needed for things like `allow(unused_imports)`)

Author: joshtriplettCreated Sep 25, 2026Updated Sep 30, 2026
LabelsC-buggood first issueI-false-positive

Summary

clippy::useless_attribute flags clippy::allow_attributes on use. However, clippy::allow_attributes is needed on a use to suppress that lint for allow(unused_imports) (or potentially other valid allow attributes). Those allows themselves are, in turn, needed when inside a macro where the lint might only fire on some applications (due to https://github.com/rust-lang/rust-clippy/issues/17562 ).

Lint Name

useless_attribute

Reproducer

rust
#[expect(clippy::allow_attributes, reason = "lint depends on macro application")]
#[allow(unused_imports)]
use path::to::something::unused;

Version

rustc 1.97.1 (8bab26f4f 2026-07-14)
binary: rustc
commit-hash: 8bab26f4f68e0e26f0bb7960be334d5b520ea452
commit-date: 2026-07-14
host: x86_64-unknown-linux-gnu
release: 1.97.1
LLVM version: 22.1.6

Additional Labels

No response