Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagnostic for unexpected paths in configuration file #11432

Open
ojeda opened this issue Aug 30, 2023 · 0 comments
Open

Diagnostic for unexpected paths in configuration file #11432

ojeda opened this issue Aug 30, 2023 · 0 comments

Comments

@ojeda
Copy link
Contributor

ojeda commented Aug 30, 2023

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).

@ojeda ojeda changed the title disallowed_macros should lint for unexpected paths Diagnostic for unexpected paths in configuration file Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant