Closed SneakyBerry closed 2 years ago
Something like:
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct A {
pub field_one: f32,
}
Will not compile since f32
is not Eq
.
Something like:
#[derive(Debug, PartialEq, Eq, Clone)] pub struct A { pub field_one: f32, }
Will not compile since
f32
is notEq
.
Yes, saw it while try to fix tests. Is it ok to use #[allow(clippy::derive_partial_eq_without_eq)]
?
Or I can try to add condition for add Eq to derives
Or I can try to add condition for add Eq to derives
It should be doable, I haven't tried it yet because recursively checking whether a record has no f32/f64 is tricky.
It might me doable with extra data in GenState
though.
Or I can try to add condition for add Eq to derives
It should be doable, I haven't tried it yet because recursively checking whether a record has no f32/f64 is tricky.
Ok. I will try it asap. Thx for hint.
@lerouxrgd I think I made it 😮💨
Thanks for looking into it !
At a first glance I would say there are a few thing than can be simplified:
GenState
that takes the deps: &[Schema]
parameter (which is expected to be calculated by deps_stack
) and apply your deep_search_float
logic to produce a HashSet<String>
of schemas containing a float (where String
is serde_json::to_string(schema)
, like in other GenState
internals).GenState::with_deps
to initialize a new field not_eq: HashSet<String>
in GenState
GenState
like this: pub fn eq_derivable(&self, schema: &Schema) -> bool
that checks that schema
is a record or a union, and is not belonging to not_eq: HashSet<String>
Templater::str_record
and Templater::str_union_enum
to initialize the value of ctx.insert("have_float", &have_float);
(maybe rename it eq_derivable
here too).
Add derive
Eq
for all types that does not consist nested float type.