From e032f1debf05f656fc5cfdf1ae3886816565d69f Mon Sep 17 00:00:00 2001 From: Michael Mullin Date: Thu, 26 Jan 2023 12:57:48 -0500 Subject: [PATCH] Ignore clippy lint warning for derive default Rust version 1.62 made it possible to use #[derive(Default)] (see: https://github.com/rust-lang/rust/pull/94457) As of rust version 1.68, the default clippy configuration will print a warning for manually impl Derive on enums. As such, users of libbpf-cargo will begin to experience clippy warnings when they migrate to version 1.68. libbpf-cargo's minimum rust version is 1.58, thus the recommended method to remove the clippy warnings, is not yet an option for the project. Add a #[allow(clippy::derivable_impls)], to suppress the clippy warning on all generated skeletons. Add a TODO to remove this once the project moves to a minimum rust version of 1.62 Signed-off-by: Michael Mullin --- libbpf-cargo/src/gen.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libbpf-cargo/src/gen.rs b/libbpf-cargo/src/gen.rs index 7ac2bc855..22181288e 100644 --- a/libbpf-cargo/src/gen.rs +++ b/libbpf-cargo/src/gen.rs @@ -670,6 +670,9 @@ fn gen_skel_attach(skel: &mut String, object: &mut BpfObj, obj_name: &str) -> Re fn gen_skel_contents(_debug: bool, raw_obj_name: &str, obj_file_path: &Path) -> Result { let mut skel = String::new(); + // TODO: remove the line + // #[allow(clippy::derivable_impls)] + // once Minimum Rust Version updated to 1.62 write!( skel, r#"// SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) @@ -683,6 +686,7 @@ fn gen_skel_contents(_debug: bool, raw_obj_name: &str, obj_file_path: &Path) -> #[allow(non_camel_case_types)] #[allow(clippy::transmute_ptr_to_ref)] #[allow(clippy::upper_case_acronyms)] + #[allow(clippy::derivable_impls)] mod imp {{ use libbpf_rs::libbpf_sys; "#