rust-lang / rust-lang/rust-clippy

`derive_partial_eq_without_eq` will trigger for third party crate derives

Open
#9,320 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug I-false-positive L-nursery T-macros
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

Summary
error: you are deriving `PartialEq` and can implement `Eq`
  --> my/project/folder/mod.rs:90:48
   |
90 |         #[derive(third_party::Trait, Debug)]
   |                  ^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq
   = note: this error originates in the derive macro `third_party::Trait` (in Nightly builds, run with -Z macro-backtrace for more info)

derive_partial_eq_without_eq seems to trigger for proc macro derives from third party crates which adds PartialEq but not Eq, which while a user can theoretically add an implementation for / derive Eq as well, it could cause breakage when the crate author updates and adds the missing implementation / derive as well

Reproducer

I tried this code:

#[derive(third_party::Trait, Debug)]

I expected to see this happen: No lint error

Instead, this happened: A lint error for derive_partial_eq_without_eq

Version
rustc 1.63.0 (4b91a6ea7 2022-08-08)
binary: rustc
commit-hash: 4b91a6ea7258a947e59c6522cd5898e7c0a6a88f
commit-date: 2022-08-08
host: aarch64-apple-darwin
release: 1.63.0
LLVM version: 14.0.5
Additional Labels

No response

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 locating the implementation and tests for the derive_partial_eq_without_eq lint in rust-clippy. Reproduce the reported #[derive(third_party::Trait, Debug)] case, then verify that derives from third-party proc macros no longer produce the lint while the intended cases still do.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.