Feature request: configuration to allow `clippy::allow_attributes` inside macro definitions/expansions
In general, I find expect preferable to allow, but in a macro definition, it's sometimes the case that a lint will only trigger on some expansions rather than all expansions, which makes it necessary to use allow rather than expect.
The current workaround I use is something like this:
#[expect(clippy::allow_attributes, reason="macro")]
#[allow(<lint>, reason = "...")]
...but it would be nice if there were a configuration option to globally do one of the following:
- Never trigger
allow_attributeswithin a macro definition or expansion - ...or, probably more complicated: treat
expectwithin a macro as fulfilled if any expansion triggers the lint
Just ran into this myself. Would be helpful if the allow_attributes lint defaulted to being allowed inside macro definitions.
(Optionally, it might be nice if there were a way to further restrict what can be allowed in macros, but that can come later.)
@rustbot label "good first issue"
We have documentation about how macros can be anoying and this is usually something fairly striaghtforward to solve. 😉
https://doc.rust-lang.org/clippy/development/macro_expansions.html
@rustbot claim
@rustbot claim