lerouxrgd / rsgen-avro

Command line and library for generating Rust types from Avro schemas
MIT License
36 stars 29 forks source link

Fix clippy errors in generated files on 1.63 rust #33

Closed SneakyBerry closed 2 years ago

SneakyBerry commented 2 years ago

Add derive Eq for all types that does not consist nested float type.

lerouxrgd commented 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.

SneakyBerry commented 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.

Yes, saw it while try to fix tests. Is it ok to use #[allow(clippy::derive_partial_eq_without_eq)]?

SneakyBerry commented 2 years ago

Or I can try to add condition for add Eq to derives

lerouxrgd commented 2 years ago

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.

SneakyBerry commented 2 years ago

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.

SneakyBerry commented 2 years ago

@lerouxrgd I think I made it 😮‍💨

lerouxrgd commented 2 years ago

Thanks for looking into it !

At a first glance I would say there are a few thing than can be simplified: