Skip to content

derive_partial_eq_without_eq will trigger for third party crate derives #9320

Open
@yoav-lavi

Description

@yoav-lavi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveL-nurseryLint: Currently in the nursery groupT-macrosType: Issues with macros and macro expansion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions