rust-lang / rust-lang/rust-clippy

Make it easier to find out how to silence clippy

Open
#6,535 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-documentation
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining how Clippy warning help text is generated and how the lint documentation at https://rust-lang.github.io/clippy/master/index.html#eq_op is connected to each warning. Compare the proposed inline #[allow(clippy::eq_op)] guidance with linking only to the documentation, and define done as making the silencing method discoverable in the warning or documented page.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.