From f0a148fd0bead21483400abd169d293f2b8d52ad Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Wed, 17 Jun 2026 11:20:01 +0200 Subject: [PATCH] rust: Fix cargo clippy false positives MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add allow attributes for intentional patterns in pvverify and pvsecret. Command line used to get the findings: $ clippy --all-features -- --cap-lints=warn ... help: remove this field --> pvverify/src/cli.rs:22:5 | 22 | version: (), | ^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive = note: `#[warn(clippy::manual_non_exhaustive)]` on by default help: use the `#[non_exhaustive]` attribute instead | 16 + #[non_exhaustive] 17 | pub struct CliOptions { | warning: struct `AddSecretOptComb` is never constructed --> pvsecret/src/cli.rs:313:12 | 313 | pub struct AddSecretOptComb<'a> { | ^^^^^^^^^^^^^^^^ | = note: `-W dead-code` implied by `-W unused` = help: to override `-W unused` add `#[expect(dead_code)]` or `#[allow(dead_code)]` warning: struct `ListSecretOptComb` is never constructed --> pvsecret/src/cli.rs:355:12 | 355 | pub struct ListSecretOptComb<'a> { | ^^^^^^^^^^^^^^^^^ warning: struct `RetrSecretOptionsComb` is never constructed --> pvsecret/src/cli.rs:490:12 | 490 | pub struct RetrSecretOptionsComb<'a> { | ^^^^^^^^^^^^^^^^^^^^^ Assisted-by: IBM Bob:1.0.4 Reviewed-by: Timo Keller Reviewed-by: Steffen Eiden Signed-off-by: Marc Hartmayer Signed-off-by: Jan Höppner --- rust/pvsecret/src/cli.rs | 9 +++++++++ rust/pvverify/src/cli.rs | 3 +++ 2 files changed, 12 insertions(+) diff --git a/rust/pvsecret/src/cli.rs b/rust/pvsecret/src/cli.rs index 1fb4937b..8b4df131 100644 --- a/rust/pvsecret/src/cli.rs +++ b/rust/pvsecret/src/cli.rs @@ -310,6 +310,9 @@ pub struct AddSecretOpt { } #[derive(Debug)] +// Allow dead_code to suppress false positive: struct fields are accessed via From trait +// implementation and used in cmd/add.rs, but clippy doesn't detect this indirect usage pattern +#[allow(dead_code)] pub struct AddSecretOptComb<'a> { pub input: &'a str, pub force: bool, @@ -352,6 +355,9 @@ pub struct ListSecretOpt { } #[derive(Debug)] +// Allow dead_code to suppress false positive: struct fields are accessed via From trait +// implementation and used in cmd/list.rs, but clippy doesn't detect this indirect usage pattern +#[allow(dead_code)] pub struct ListSecretOptComb<'a> { pub output: &'a str, pub format: ListSecretOutputType, @@ -487,6 +493,9 @@ pub enum RetrOutFmt { } #[derive(Debug)] +// Allow dead_code to suppress false positive: struct fields are accessed via From trait +// implementation and used in cmd/retr.rs, but clippy doesn't detect this indirect usage pattern +#[allow(dead_code)] pub struct RetrSecretOptionsComb<'a> { pub input: &'a str, pub output: &'a str, diff --git a/rust/pvverify/src/cli.rs b/rust/pvverify/src/cli.rs index 27244d3f..b9c52e4c 100644 --- a/rust/pvverify/src/cli.rs +++ b/rust/pvverify/src/cli.rs @@ -13,6 +13,9 @@ static VERSION: OnceLock = OnceLock::new(); /// Tool to verify host-keys /// /// Tool to verify host-keys. Use this tool to verify the chain of trust for IBM Secure +// Allow manual_non_exhaustive to suppress Clippy false positive as the version +// field is used by Clap to generate the --version flag. +#[allow(clippy::manual_non_exhaustive)] pub struct CliOptions { #[command(flatten)] pub certificate_args: CertificateOptions,