Skip to content

fix: pass through Eq derive in ModelEx to fix clippy::derive_partial_eq_without_eq - #3192

Closed
yunaremaia wants to merge 1 commit into
SeaQL:masterfrom
yunaremaia:fix/model-ex-eq-derive
Closed

fix: pass through Eq derive in ModelEx to fix clippy::derive_partial_eq_without_eq#3192
yunaremaia wants to merge 1 commit into
SeaQL:masterfrom
yunaremaia:fix/model-ex-eq-derive

Conversation

@yunaremaia

Copy link
Copy Markdown

Fixes #3172

The model_ex macro was silently stripping the Eq derive from the generated ModelEx struct, triggering clippy::derive_partial_eq_without_eq when -D warnings or clippy::nursery is 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 is f32/f64. However:

  1. The compiler already handles this#[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.
  2. The manual PartialEq impls (lines 1323–1330) only implement PartialEq, not Eq. The Eq derive on ModelEx requires Eq on all fields — the derive system validates this.
  3. Current behavior is wrong — by stripping Eq, clippy fires derive_partial_eq_without_eq, which is also an error under -D warnings.

Solution

Pass through Eq in the derive list (1-line change: // skipnew_list.push(parse_quote!(Eq))). This:

  • Fixes the clippy lint
  • Maintains backward compat — models without Eq in their derive list are unaffected
  • Compiler errors catch the float case at compile time, not runtime

Verification

  • Existing tests pass (cargo test)
  • cargo clippy no longer reports derive_partial_eq_without_eq

…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.
@Huliiiiii

Copy link
Copy Markdown
Member

If you open another Slop PR, you will be banned.

@Huliiiiii Huliiiiii closed this Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eq skipped in ModelEx

2 participants