Skip to content

Commit

Permalink
Don't explicitly derive Eq for enums
Browse files Browse the repository at this point in the history
I got bitten by this bug: tokio-rs/prost#332
when I added the enum `ShieldedProtocol` to the file `service.proto`.
The problem is that `prost` implicitly derives `Eq` for enums, so
deriving it explicitly via `type_attribute` causes a conflict. Lukily,
there is another method `message_attribute` that operates only on
messages and not enums.
  • Loading branch information
upbqdn committed Sep 11, 2023
1 parent d4b6d6c commit 010c0fa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion zebrad/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn main() {
// The lightwalletd gRPC types don't use floats or complex collections,
// so we can derive `Eq` as well as the default generated `PartialEq` derive.
// This fixes `clippy::derive_partial_eq_without_eq` warnings.
.type_attribute(".", "#[derive(Eq)]")
.message_attribute(".", "#[derive(Eq)]")
.compile(
&["tests/common/lightwalletd/proto/service.proto"],
&["tests/common/lightwalletd/proto"],
Expand Down

0 comments on commit 010c0fa

Please sign in to comment.