mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
301aae6ac8
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