Skip to content

Commit ddbb119

Browse files
committed
libbpf-cargo: Suppress some Clippy warnings
With the changes to initialize maps inline during skeleton open/load, we may end up with Clippy complaining that a loop never loops or a match never matches, if there are no maps present. Silence the warnings. Such patterns are to be expected in generated code like this. Closes: #921 Signed-off-by: Daniel Müller <[email protected]>
1 parent 658277e commit ddbb119

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

libbpf-cargo/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Unreleased
2+
----------
3+
- Silenced possible `clippy` reported warnings in generated skeleton
4+
when BPF object file does not contain any maps
5+
6+
17
0.24.2
28
------
39
- Fixed panic on "open" of skeleton with `kconfig` map

libbpf-cargo/src/gen/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ fn gen_skel_map_defs(
458458
let object = unsafe {{
459459
std::mem::transmute::<&mut libbpf_rs::{prefix}Object, &'obj mut libbpf_rs::{prefix}Object>(object)
460460
}};
461+
#[allow(clippy::never_loop)]
461462
for map in object.maps_mut() {{
462463
let name = map
463464
.name()
@@ -468,6 +469,7 @@ fn gen_skel_map_defs(
468469
\"map has invalid name\",
469470
))
470471
}})?;
472+
#[allow(clippy::match_single_binding)]
471473
match name {{
472474
",
473475
)?;

0 commit comments

Comments
 (0)