rust-lang / rust-lang/rust-clippy

Clippy reports warnings twice on suggestion errors

Open
#6,235 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-ui C-bug L-suggestion
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

I tried the code from https://github.com/rust-lang/rust-clippy/issues/6234.
I expected to see one error, from the incorrect 'fixed' code, and one warning from the original code.

Instead, this happened: I saw one error and two warnings:

Original diagnostics will follow.

warning: immediately dereferencing a reference
 --> src/lib.rs:2:26
  |
2 |     ($visitor: expr) => (*&$visitor)
  |                          ^^^^^^^^^^ help: try this: `self`
...
8 |         m!(self)
  |         -------- in this macro invocation
  |
  = note: `#[warn(clippy::deref_addrof)]` on by default
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#deref_addrof
  = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

warning: immediately dereferencing a reference
 --> src/lib.rs:2:26
  |
2 |     ($visitor: expr) => (*&$visitor)
  |                          ^^^^^^^^^^ help: try this: `self`
...
8 |         m!(self)
  |         -------- in this macro invocation
  |
  = note: `#[warn(clippy::deref_addrof)]` on by default
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#deref_addrof
  = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

warning: 1 warning emitted

warning: 1 warning emitted
Meta
  • cargo clippy -V: clippy 0.0.212 (ffa2e7a 2020-10-24)

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 reproducing the example from issue 6234 in src/lib.rs and running cargo clippy, using the reported clippy version as context. Done means the incorrect fixed code still produces one error while the original code produces only one warning rather than duplicated diagnostics.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.