From 152f446d76f6522eccf775d8ac479a19c90a1a6a Mon Sep 17 00:00:00 2001 From: Jakob Naucke Date: Wed, 15 Jan 2025 16:22:00 +0100 Subject: [PATCH] rust: Fix `cargo clippy` findings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the new `cargo clippy` findings for updated 1.84 toolchain. Signed-off-by: Jakob Naucke Reviewed-by: Steffen Eiden Signed-off-by: Jan Höppner --- rust/pv/src/brcb.rs | 2 +- rust/pv/src/crypto.rs | 2 +- rust/pv_core/src/uvdevice/retr_secret.rs | 2 +- rust/pvimg/src/pv_utils/secured_comp.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust/pv/src/brcb.rs b/rust/pv/src/brcb.rs index ac481fce..0afda41b 100644 --- a/rust/pv/src/brcb.rs +++ b/rust/pv/src/brcb.rs @@ -41,7 +41,7 @@ impl TryFrom> for BootHdrTags { fn try_from(value: Vec) -> Result { Self::ref_from(&value) - .ok_or_else(|| Error::InvBootHdrSize(value.len())) + .ok_or(Error::InvBootHdrSize(value.len())) .copied() } } diff --git a/rust/pv/src/crypto.rs b/rust/pv/src/crypto.rs index ebc85f72..27bd9786 100644 --- a/rust/pv/src/crypto.rs +++ b/rust/pv/src/crypto.rs @@ -361,7 +361,7 @@ pub fn encrypt_aead( aad: &[u8], conf: &[u8], ) -> Result { - let tag_len = key.key_type().tag_len().ok_or_else(|| Error::NoAeadKey)?; + let tag_len = key.key_type().tag_len().ok_or(Error::NoAeadKey)?; let nid = key.key_type().into(); let cipher = Cipher::from_nid(nid).ok_or(Error::UnsupportedCipher(nid))?; diff --git a/rust/pv_core/src/uvdevice/retr_secret.rs b/rust/pv_core/src/uvdevice/retr_secret.rs index b818d245..041fceac 100644 --- a/rust/pv_core/src/uvdevice/retr_secret.rs +++ b/rust/pv_core/src/uvdevice/retr_secret.rs @@ -266,7 +266,7 @@ impl<'de> Deserialize<'de> for RetrievableSecret { D: serde::Deserializer<'de>, { struct RetrSecretVisitor; - impl<'de> serde::de::Visitor<'de> for RetrSecretVisitor { + impl serde::de::Visitor<'_> for RetrSecretVisitor { type Value = RetrievableSecret; fn expecting(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result { diff --git a/rust/pvimg/src/pv_utils/secured_comp.rs b/rust/pvimg/src/pv_utils/secured_comp.rs index ae85e9f4..93a3613b 100644 --- a/rust/pvimg/src/pv_utils/secured_comp.rs +++ b/rust/pvimg/src/pv_utils/secured_comp.rs @@ -359,7 +359,7 @@ impl SecuredComponentBuilder { ) -> Result { let digest = MessageDigest::from_nid(digest_nid).ok_or(Error::UnsupportMessageDigest)?; let nid = key_type.into(); - let cipher = Cipher::from_nid(nid).ok_or_else(|| PvError::UnsupportedCipher(nid))?; + let cipher = Cipher::from_nid(nid).ok_or(PvError::UnsupportedCipher(nid))?; let key = SymKey::random(key_type)?; Ok(Self {