rust: Fix cargo clippy findings

Fix the new `cargo clippy` findings for updated 1.84 toolchain.

Signed-off-by: Jakob Naucke <naucke@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Jakob Naucke
2025-01-15 16:22:00 +01:00
committed by Jan Höppner
parent 646e080217
commit 152f446d76
4 changed files with 4 additions and 4 deletions

View File

@@ -41,7 +41,7 @@ impl TryFrom<Vec<u8>> for BootHdrTags {
fn try_from(value: Vec<u8>) -> Result<Self, Self::Error> {
Self::ref_from(&value)
.ok_or_else(|| Error::InvBootHdrSize(value.len()))
.ok_or(Error::InvBootHdrSize(value.len()))
.copied()
}
}

View File

@@ -361,7 +361,7 @@ pub fn encrypt_aead(
aad: &[u8],
conf: &[u8],
) -> Result<AeadEncryptionResult> {
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))?;

View File

@@ -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 {

View File

@@ -359,7 +359,7 @@ impl SecuredComponentBuilder {
) -> Result<Self> {
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 {