Skip to content

Commit

Permalink
ocicrypt: keyprovider: fix warnings on dead code
Browse files Browse the repository at this point in the history
For quite some time, we have seen:

warning: struct `TestRunner` is never constructed
Warning:    --> ocicrypt-rs/src/keywrap/keyprovider/mod.rs:558:16
    |
558 |     pub struct TestRunner {}
    |                ^^^^^^^^^^
    |
    = note: `TestRunner` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis
    = note: `#[warn(dead_code)]` on by default

warning: struct `TestServer` is never constructed
Warning:    --> ocicrypt-rs/src/keywrap/keyprovider/mod.rs:570:12
    |
570 |     struct TestServer {}
    |            ^^^^^^^^^^
    |
    = note: `TestServer` has a derived impl for the trait `Default`, but this is intentionally ignored during dead code analysis

The fix is to add them behind the right feature flags.

Signed-off-by: Mikko Ylinen <[email protected]>
  • Loading branch information
mythi authored and arronwy committed Sep 9, 2024
1 parent 0e0fb72 commit b599062
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ocicrypt-rs/src/keywrap/keyprovider/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ mod tests {

///Test runner which mocks binary executable for key wrapping and unwrapping
#[derive(Clone, Copy)]
#[cfg(feature = "keywrap-keyprovider-cmd")]
pub struct TestRunner {}

///Mock annotation packet, which goes into container image manifest
Expand All @@ -567,6 +568,10 @@ mod tests {

///grpc server with mock api implementation for serving the clients with mock WrapKey and Unwrapkey grpc method implementations
#[derive(Default)]
#[cfg(any(
feature = "keywrap-keyprovider-grpc",
feature = "keywrap-keyprovider-ttrpc"
))]
struct TestServer {}

#[cfg(any(
Expand Down

0 comments on commit b599062

Please sign in to comment.