Skip to content

As of Rust v1.62, enums can now use #[derive(Default)] #333

Closed
@mimullin-bbry

Description

@mimullin-bbry

Rust version 1.62 stabilized using derive(Default) for enums by marking the #[default] value to be used

See: rust-lang/rust#94457

Rust version 1.69 (unsure about 1.68) will start throwing a clippy warning for using manual impl Default when the derive(Default) can be used. These warnings will apply to the generated skeletons created by libbpf-cargo, causing issues to users.

    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
    = note: `#[warn(clippy::derivable_impls)]` on by default
    = help: remove the manual implementation...
help: ...and instead derive it...

libbpf-cargo should either update the minimum version to 1.62 and use the derive(Default) in this area of the code (https://github.com/libbpf/libbpf-rs/blob/master/libbpf-cargo/src/btf/btf.rs#L989). Or a #![allow(clippy::derivable_impls)] can be added to this area of the code (https://github.com/libbpf/libbpf-rs/blob/master/libbpf-cargo/src/gen.rs#L684), and the MRV can stay at 1.58.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions