Skip to content

Commit 09d10f7

Browse files
ojedafbq
authored andcommitted
rust: allow dead_code for never constructed bindings
Starting with the upcoming Rust 1.80.0 (since upstream commit 35130d7233e9 ("Detect pub structs never constructed and unused associated constants in traits")), the `dead_code` pass detects more cases, which triggers in the `bindings` crate: warning: struct `boot_params` is never constructed --> rust/bindings/bindings_generated.rs:10684:12 | 10684 | pub struct boot_params { | ^^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default As well as in the `uapi` one: warning: struct `boot_params` is never constructed --> rust/uapi/uapi_generated.rs:10392:12 | 10392 | pub struct boot_params { | ^^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default These are all expected, since we do not use all the structs in the bindings that `bindgen` generates from the C headers. Therefore, allow them. Reviewed-by: Björn Roy Baron <[email protected]> Reviewed-by: Finn Behrens <[email protected]> Tested-by: Benno Lossin <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent bd4b3ba commit 09d10f7

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

rust/bindings/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
unsafe_op_in_unsafe_fn
2525
)]
2626

27+
#[allow(dead_code)]
2728
mod bindings_raw {
2829
// Use glob import here to expose all helpers.
2930
// Symbols defined within the module will take precedence to the glob import.

rust/uapi/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#![cfg_attr(test, allow(unsafe_op_in_unsafe_fn))]
1515
#![allow(
1616
clippy::all,
17+
dead_code,
1718
missing_docs,
1819
non_camel_case_types,
1920
non_upper_case_globals,

0 commit comments

Comments
 (0)