Skip to content

Diagnostic for unexpected paths in configuration file #11432

Closed
@ojeda

Description

@ojeda

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 if x is not a crate.
  • Paths to an item that exists but is not a macro, e.g. x::m if m is not a macro.
  • Paths to items that do not exist, e.g. x::m if there is no m.
  • 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 allowed or somehow conditional compilation handled within the config file (#11433; of course, a workaround could be users generating the config file on the fly).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions