hyperium / tonic

A native gRPC client & server implementation with async/await support.
https://docs.rs/tonic
MIT License
9.76k stars 997 forks source link

tonic-build with rust/clippy 1.63.0: `derive_partial_eq_without_eq` #1058

Closed g0hl1n closed 2 years ago

g0hl1n commented 2 years ago

Bug Report

Version

$ cargo tree | grep -e tonic -e prost
├── prost v0.11.0
│   └── prost-derive v0.11.0 (proc-macro)
├── prost-types v0.11.1
│   └── prost v0.11.0 (*)
└── tonic v0.8.0
    ├── prost v0.11.0 (*)
    ├── prost-derive v0.11.0 (proc-macro) (*)
├── tonic-build v0.8.0
│   ├── prost-build v0.11.1
│   │   ├── prost v0.11.0
│   │   │   └── prost-derive v0.11.0 (proc-macro) (*)
│   │   ├── prost-types v0.11.1
│   │   │   └── prost v0.11.0 (*)

Platform

Linux 5.18.17-200.fc36.x86_64

Crates

tonic-build

Description

After updating to rust 1.63.0 clippy shows following warning:

warning: you are deriving `PartialEq` and can implement `Eq`
     |
1452 | #[derive(Clone, PartialEq, ::prost::Message)]
     |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

From https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq:

If a type T derives PartialEq and all of its members implement Eq, then T can always implement Eq. Implementing Eq allows T to be used in APIs that require Eq types. It also allows structs containing T to derive Eq themselves.

I'm using following build code in my build.rs:

    tonic_build::configure()
        .build_server(true)
        .include_file(&include_file)
        .compile(&protos, &[proto_path])?;

And this is the relevant Cargo.toml section:

[dependencies]
prost = "0.11"
prost-types = "0.11"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
tokio-stream = "0.1"
tonic = "0.8"

[build-dependencies]
tonic-build = { version = "0.8", features = ["prost"] }
LucioFranco commented 2 years ago

Duplicate https://github.com/hyperium/tonic/issues/1056

g0hl1n commented 2 years ago

Duplicate #1056

sorry, my bad, didn't see that one.