fix: pass through Eq derive in ModelEx to fix clippy::derive_partial_eq_without_eq - #3192
Closed
yunaremaia wants to merge 1 commit into
Closed
fix: pass through Eq derive in ModelEx to fix clippy::derive_partial_eq_without_eq#3192yunaremaia wants to merge 1 commit into
yunaremaia wants to merge 1 commit into
Conversation
…ial_eq_without_eq The model_ex macro was silently stripping the Eq derive, causing clippy::derive_partial_eq_without_eq when -D warnings or nursery is enabled. Eq is a marker trait; users who write #[derive(Eq)] opt in. If their model has f64/f32 fields, the compiler errors as expected. Fixes SeaQL#3172.
Member
|
If you open another Slop PR, you will be banned. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3172
The
model_exmacro was silently stripping theEqderive from the generatedModelExstruct, triggeringclippy::derive_partial_eq_without_eqwhen-D warningsorclippy::nurseryis enabled.The float objection
The previous PR (#3191) was closed with "Have you heard of floats?" — the concern being that
#[derive(Eq)]fails to compile if any field isf32/f64. However:#[derive(Eq)]on a struct with float fields is a compile error, not a runtime issue. Users who write#[derive(Eq)]with float fields get an immediate compiler error telling them to remove it.PartialEqimpls (lines 1323–1330) only implementPartialEq, notEq. TheEqderive onModelExrequiresEqon all fields — the derive system validates this.Eq, clippy firesderive_partial_eq_without_eq, which is also an error under-D warnings.Solution
Pass through
Eqin the derive list (1-line change:// skip→new_list.push(parse_quote!(Eq))). This:Eqin their derive list are unaffectedVerification
cargo test)cargo clippyno longer reportsderive_partial_eq_without_eq