Skip to content

Option to print the status of all clippy lints #5385

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

Closed
flaviojs opened this issue Mar 29, 2020 · 4 comments
Closed

Option to print the status of all clippy lints #5385

flaviojs opened this issue Mar 29, 2020 · 4 comments

Comments

@flaviojs
Copy link

There is no way to see the status of all lints right now. (allow, warn, deny, disabled?)

I was getting more warnings in the unix CI than in my unix VM.
Later I found the cause was not using --all-features in the VM command.
I didn't expect it to change the lints, only my code, and debugging this was terrible because I can't see the status of the lints.

The output could be in clippy.toml format with everything explicit. (serialize to toml)
This would facilitate the creation of that file since there would be a clear reference.

@flaviojs
Copy link
Author

As for the command, maybe cargo clippy --print lints? (inspired by rustc)

@flip1995
Copy link
Member

flip1995 commented Mar 30, 2020

Specifying --all-features doesn't enable or disable more Clippy lints. It turns on the features of the linted crate and therefore more code is linted. All lints with their levels are defined here: https://rust-lang.github.io/rust-clippy/master/index.html (or if you use a specific version of Clippy, select it here: https://rust-lang.github.io/rust-clippy/)

The clippy.toml file is not there to allow or deny lints. It probably never will be. If something like this would be implemented it would be a lint.toml file in cargo, that specifies lints by lint tool (rustc or Clippy and maybe more in the future).

For a list of lints, there's the command cargo clippy -- -W help. This is not documented, since it is not at all stable.

@flaviojs
Copy link
Author

Weird... I think that the code with extra warnings was always compiled. (in the lib, not a test)
Ignoring test (standard feature), the only feature I have is enabled by default.
It pulls the dependencies of the optional binary that the crate can build.

cargo clippy -- -W help seems to be enough for debug purposes, thanks.

@lnicola
Copy link
Member

lnicola commented Oct 6, 2020

cargo clippy -- -W help seems to run clippy, so it takes a while on a first build and, of course, it requires a project. Would it be possible to print the available lints and quit, similar to rustc -W help?

Context: in rust-analyzer we'd like to offer code completions for the various lints, but the only way to get them is to download http://rust-lang.github.io/rust-clippy/master/lints.json.

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

3 participants