Files
rust/tests
llogiq 301aae6ac8 fix: allow_attributes false negative on attributes with whitespace (#16497)
The [`allow_attributes`] lint false-negatived (failed to trigger) on
attributes that contained internal whitespace, such as `#[ allow (
dead_code ) ]`.

This happened because `clippy_utils::is_from_proc_macro` relied on
strict string matching (e.g., expecting exactly `#[allow`), which fails
if there are spaces.

#### Solution:
I have updated `clippy_utils::is_from_proc_macro` to support flexible
whitespace matching.
1. Added `Pat::Attr(Symbol)`.
2. Updated `span_matches_pat` to strip `#[` and trim validation
whitespace before checking the name.

Verified with a new test case in `tests/ui/allow_attributes.rs`.

Fixes rust-lang/rust-clippy#16491

----

changelog: [`allow_attributes`]: correctly detect attributes with
internal whitespace
2026-02-02 08:06:54 +00:00
..