-
-
Notifications
You must be signed in to change notification settings - Fork 500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[codegen] Struct / enum derive PartialEq
should also derive Eq
#965
Comments
PartialEq
should also derive Eq
Thanks! @baoyachi |
Oh,I see you've done it。 |
Nope, it's not |
#967 doesn't touch code generator of codegen |
It's seem's touch sea-query create ...
/// Value variants
///
/// We want Value to be exactly 1 pointer sized, so anything larger should be boxed.
+ #[derive(Clone, Debug, PartialEq)]
pub enum Value {
Bool(Option<bool>),
TinyInt(Option<i8>),
SmallInt(Option<i16>),
Int(Option<i32>),
... |
So,first need change sea-query? |
I don't think we need an option for this behaviour. It seems to be universally true that we want Eq and PartialEq wherever possible. We can simply change the codegen for enum. For any struct (that contains a f64), implementing Eq is not possible. |
There are only three place in the codegen we need to modify:
Btw... both |
May I take this one? If I understand correctly, only the above files need to be changed? |
Hey @w93163red, sure! Please go ahead :) |
But note that if we have any |
I submitted a PR. If you find anything wrong, please let me know. Thanks~ |
Thanks! @w93163red Please check the comment: #988 (review) |
Motivation
New clippy lint was added in Rust 1.63.0. which checks for types that derive
PartialEq
and could implementEq
.Example:
Do this instead:
Proposed Solutions
Check
sea-orm-codegen
where#[derive(PartialEq)]
should be changed to#[derive(PartialEq, Eq)]
.Additional Information
Clippy lints index: https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq
The text was updated successfully, but these errors were encountered: