-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Description
Some lints that are configured via clippy.toml
may need to react to conditional compilation.
For instance, for disallowed_macros
, a project may want to warn only about a particular macro in some configurations (e.g. CI vs. development).
It could also be useful if Clippy were to identify unexpected paths to prevent mistakes (#11432), since it would allow the user to e.g. remove a given macro from the list if the macro is compiled out.
A workaround could be users generating Clippy's config file on the fly.
Perhaps Clippy could instead allow to be configured within the Rust source code (step-by-step), so that the #[cfg]
syntax/machinery is reused, but I imagine there is a reason it was not done there (e.g. workspaces sharing config easily?), e.g.
// `m1` always disallowed.
#[clippy_config(disallowed_macros, "m1")]
// `m2` only disallowed if `X`.
#[cfg(X)]
#[clippy_config(disallowed_macros, "m2")]
PaulDance
Metadata
Metadata
Assignees
Labels
No labels