Skip to content

Make it easier to find out how to silence clippy #6535

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

Open
ChrisJefferson opened this issue Jan 2, 2021 · 4 comments
Open

Make it easier to find out how to silence clippy #6535

ChrisJefferson opened this issue Jan 2, 2021 · 4 comments
Labels
A-documentation Area: Adding or improving documentation

Comments

@ChrisJefferson
Copy link

ChrisJefferson commented Jan 2, 2021

I often find I want to silence some clippy warning (for example, clippy has just warned me about assert!(!(d<d)), which is reasonable, except it's in a test and I really do want to check it).

While it might add more noise, I wonder if the 'help' line could be extended to say how to silence the warning, for example (I've added to the end)

warning: equal expressions as operands to `<`
   --> src/datastructures/digraph.rs:174:18
    |
174 |         assert!(!(d < d));
    |                  ^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#eq_op ,
       or silence this warning by adding #[allow(clippy::eq_op)] to the function

Or, this information could be added to https://rust-lang.github.io/rust-clippy/master/index.html#eq_op .

At the moment, (because I have a bad memory and don't do it often), every time I want to silence a clippy warning I have to google for it.

@giraffate giraffate added the C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages label Jan 2, 2021
@flip1995 flip1995 added good-first-issue These issues are a good way to get started with Clippy A-documentation Area: Adding or improving documentation and removed C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages labels Jan 2, 2021
@flip1995
Copy link
Member

flip1995 commented Jan 2, 2021

Allowing Clippy lints works just like allowing rustc lints, with #[allow(clippy::lint_name)]. This is explicitly explained in the readme of Clippy. I don't really see how adding this to every warning would improve the situation. IMO, it would only clump up the message.

@ChrisJefferson
Copy link
Author

After rethinking, I agree about not putting it into the lint message, but maybe the linked website -- or the website could have at least have an obvious link to the manual (is the current manual just the github readme?)

@flip1995
Copy link
Member

flip1995 commented Jan 2, 2021

Yeah, currently it's just the GitHub readme. We plan to write a Clippy Book. I'll leave this issue open, so we'll remember to include this.

@ThibsG
Copy link
Contributor

ThibsG commented Jan 3, 2021

Related issue: #6011

@Alexendoo Alexendoo removed the good-first-issue These issues are a good way to get started with Clippy label Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documentation Area: Adding or improving documentation
Projects
None yet
Development

No branches or pull requests

5 participants