Diagnostic for unexpected paths in configuration file · Issue #11432 · rust-lang/rust-clippy (original) (raw)
It would be nice if Clippy would emit a diagnostic for unexpected paths in the configuration file (e.g. in lints like disallowed_macros
). For instance:
- Empty and invalid paths (i.e. non-paths), e.g.
x:::m
. - Paths that do not start with a crate, e.g.
x::m
ifx
is not a crate. - Paths to an item that exists but is not a macro, e.g.
x::m
ifm
is not a macro. - Paths to items that do not exist, e.g.
x::m
if there is nom
. - etc.
Otherwise, it is easy to make mistakes in the configuration file that will lead to no linting from Clippy. #[expect]
, expected-to-warn tests and similar approaches on the user's side can alleviate this, but it is best to offer it out of the box.
Some of the cases above may be undesirable in some cases (e.g. conditional compilation may make a macro disappear completely in some builds, as well as all its callers), but it may be still worth to have in many cases, if it can be allow
ed or somehow conditional compilation handled within the config file (#11433; of course, a workaround could be users generating the config file on the fly).