From 2f9ee62a289aab78ca37cb055f3cd4ae5eacd5ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sosth=C3=A8ne=20Gu=C3=A9don?= Date: Thu, 6 Apr 2023 10:36:28 +0200 Subject: [PATCH] Fix clippy warnings --- src/lib.rs | 18 +++++++++--------- tests/command_response.rs | 9 ++------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 5643110..477830a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -58,7 +58,7 @@ impl Default for Options { impl Options { pub fn storage(self, storage: Location) -> Self { - Self { storage, ..self } + Self { storage } } } @@ -493,17 +493,17 @@ impl<'a, T: trussed::Client + trussed::client::Ed255> LoadedAuthenticator<'a, T> exponentiation: None, } => self.mutual_auth_2(auth, r, c, reply.lend())?, Auth { - witness, - challenge, - response, - exponentiation, + witness: _witness, + challenge: _challenge, + response: _response, + exponentiation: _exponentiation, } => { warn!( "General authenticate with unexpected data: witness: {:?}, challenge: {:?}, response: {:?}, exponentiation: {:?}", - witness.map(|s|s.len()), - challenge.map(|s|s.len()), - response.map(|s|s.len()), - exponentiation.map(|s|s.len()), + _witness.map(|s|s.len()), + _challenge.map(|s|s.len()), + _response.map(|s|s.len()), + _exponentiation.map(|s|s.len()), ); return Err(Status::IncorrectDataParameter); } diff --git a/tests/command_response.rs b/tests/command_response.rs index 1cf95f1..9f36b14 100644 --- a/tests/command_response.rs +++ b/tests/command_response.rs @@ -12,8 +12,9 @@ use serde::Deserialize; use trussed::types::GenericArray; // iso7816::Status doesn't support serde -#[derive(Deserialize, Debug, PartialEq, Clone, Copy)] +#[derive(Deserialize, Debug, PartialEq, Clone, Copy, Default)] enum Status { + #[default] Success, MoreAvailable(u8), VerificationFailed, @@ -178,12 +179,6 @@ impl TryFrom for Status { } } -impl Default for Status { - fn default() -> Status { - Status::Success - } -} - #[derive(Deserialize, Debug)] #[serde(deny_unknown_fields)] struct IoTest {