Giter VIP home page Giter VIP logo

Comments (3)

neoeinstein avatar neoeinstein commented on August 22, 2024 3

Nearly all of the actual code generation done by protoc-gen-prost and similar crates is delegated to underlying code generators. In this case, it will have been prost-build that produced these. Back when this new lint was on nightly, an issue was posted to the prost repository. You can read the response there: tokio-rs/prost#661

The recommendation seems to be to add an #[allow(clippy::derive_partial_eq_without_eq)] onto the crate or module where you're including the generated code.

from protoc-gen-prost.

o-agassizii avatar o-agassizii commented on August 22, 2024 1

Even though most people may not treat clippy lint warnings as errors, it seems to me that it would be desirable for the code generated by protoc-gen-prost to adhere to this lint.

from protoc-gen-prost.

o-agassizii avatar o-agassizii commented on August 22, 2024

Minimal reproducible example:

Assuming protoc, buf, protoc-gen-prost and Rust toolchain version 1.63.0 have already been installed.

protoc --version
libprotoc 3.20.1
buf --version
1.7.0
protoc-gen-prost --version
0.2.0
cargo version
cargo 1.63.0 (fd9c4297c 2022-07-01)

Then clone the protoc-gen-prost repo and use one of the code generation examples from there.

mkdir -p ~/tmp/github.com/neoeinstein
cd ~/tmp/github.com/neoeinstein
git clone https://github.com/neoeinstein/protoc-gen-prost.git
cd protoc-gen-prost/example/build-with-buf
buf generate
cargo clippy --all --all-targets --all-features -- -Dwarnings -Drust-2018-idioms

We see the new clippy lint derive_partial_eq_without_eq is triggered.

[...]
Checking build-with-buf v0.1.0 (/Users/o-agassizii/tmp/github.com/neoeinstein/protoc-gen-prost/example/build-with-buf)
error: you are deriving `PartialEq` and can implement `Eq`
 --> src/gen/example.rs:2:17
  |
2 | #[derive(Clone, PartialEq, ::prost::Message)]
  |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
  |
  = note: `-D clippy::derive-partial-eq-without-eq` implied by `-D warnings`
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

error: you are deriving `PartialEq` and can implement `Eq`
 --> src/gen/example.rs:7:17
  |
7 | #[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

error: could not compile `build-with-buf` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `build-with-buf` due to 2 previous errors

from protoc-gen-prost.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.