-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
As of Rust v1.62, enums can now use #[derive(Default)] #333
Comments
Thanks for pointing that out. It does not seem worth it to bump our minimum supported Rust version by four for this minor improvement, to be honest, so I am tempted to just suppress the warning, and include a TODO to fix this up once we require this version anyway. Are you interested in creating a pull request by any chance, @mimullin-bbry ? |
I am, I just was interested in guidance about which path the project would prefer. The "stay with 1.58" is a much less invasive and easier to implement fix (just plop in the allow and be done with it), however the derive(Default) method makes the generated skeletons slightly more readable (though not by much tbh). Also, the clippy warning isn't specific to just enums; suppressing the warning means the project will miss out on methods to make the generated skeletons "cleaner" in the future. |
Sounds good. Yeah, I am not saying we should never go with
Fair enough. I am not too worried about that, though. For one, we should try and tag the smallest entity in question (the very |
I'll go with the "stick to 1.58". FYI: Beta just updated to 1.68, and the clippy warning is occurring. Thus, this issue might start impacting people's work flows. I'll try and get an MR ready this evening after work. |
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.
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
The text was updated successfully, but these errors were encountered: