From 5b8fdc2becab125d63c100b710a26fdccd9b824a Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Fri, 26 Jun 2026 16:08:42 +0200 Subject: [PATCH] pv: Improve API by marking some functions as must_use Make the API less prone to error by specifying some of them as must_use. This avoids issues that the result is not used. Signed-off-by: Marc Hartmayer Reviewed-by: Steffen Eiden Signed-off-by: Steffen Eiden --- rust/pv/src/crypto.rs | 1 + rust/pv/src/req/keyslot.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/rust/pv/src/crypto.rs b/rust/pv/src/crypto.rs index 65b4f994..d4442a06 100644 --- a/rust/pv/src/crypto.rs +++ b/rust/pv/src/crypto.rs @@ -119,6 +119,7 @@ impl SymKeyType { } /// Returns true if the [`SymKeyType`] is an AEAD key + #[must_use] pub const fn is_aead(&self) -> bool { self.tag_len().is_some() } diff --git a/rust/pv/src/req/keyslot.rs b/rust/pv/src/req/keyslot.rs index b8415fac..633e1e4f 100644 --- a/rust/pv/src/req/keyslot.rs +++ b/rust/pv/src/req/keyslot.rs @@ -182,6 +182,7 @@ impl Keyslot { } /// Return the public host key hash size for the given version of the key-slot in bytes + #[must_use] pub fn phkh_size(&self) -> u32 { match self { Keyslot::V1(_) => KeyslotV1::PHKH_SIZE, @@ -190,6 +191,7 @@ impl Keyslot { } /// Return the size of the key-slot in bytes + #[must_use] pub fn size(&self) -> usize { match self { Keyslot::V1(_) => KeyslotV1::SIZE,