Skip to content

Commit

Permalink
Ignore clippy lint warning for derive default
Browse files Browse the repository at this point in the history
Rust version 1.62 made it possible to use #[derive(Default)]
on enums.
(see: rust-lang/rust#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 <[email protected]>
  • Loading branch information
mimullin-bbry authored and masmullin2000 committed Jan 26, 2023
1 parent 1a8155f commit f370cd8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libbpf-cargo/src/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> {
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)
Expand All @@ -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;
"#
Expand Down

0 comments on commit f370cd8

Please sign in to comment.