Comments (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.
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.
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)
- [Bug] `protoc-gen-prost` 0.2.1 now is broken directly from cargo registry HOT 4
- plugin prost-crate: The system couldn't find the given file. (os error 2) HOT 5
- protoc-gen-prost-serde: doesn't generate .serde.rs for module with "type" in its name HOT 2
- Failure when compiling with file_descriptor_set HOT 3
- How to properly use protoc-gen-prost-crate
- Failure with tonic when a proto file has only service definitions HOT 6
- Release a new version of protoc-gen-prost-crate HOT 1
- Add example for how to use well known types with buf HOT 1
- add max message size configuration to generated service HOT 1
- More verbose error message when compilation fails HOT 1
- Bug: Protos with duplicate package names fail to generate any files
- Missing tags on latest release HOT 1
- File generated by tonic cannot compile directly HOT 1
- Update generation to prost 0.12 HOT 4
- Failure: plugin prost-crate: could not find protoc plugin for name prost-crate - please make sure protoc-gen-prost-crate is installed and present on your $PATH HOT 4
- Support `axum-connect` code gen HOT 2
- Missing support for option json_name HOT 1
- `exclude` option not supported in protoc-gen-prost-serde
- How to replace include!("v1.account.rs") on #[path = "v1.account.rs"] ?
- Suggestion: support the `prost_build::Config::include_file` option HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from protoc-gen-prost.