From 48539596efc8744802f29c198724f59560bd0ea6 Mon Sep 17 00:00:00 2001 From: Steffen Eiden Date: Fri, 19 Jan 2024 15:01:11 +0100 Subject: [PATCH] rust/pv: Use constants for invalid secret types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add local constants for the reserved, and Null secret type and use them. Reviewed-by: Marc Hartmayer Signed-off-by: Steffen Eiden Signed-off-by: Jan Höppner --- rust/pv/src/uvsecret/secret_list.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rust/pv/src/uvsecret/secret_list.rs b/rust/pv/src/uvsecret/secret_list.rs index 72a05b27..c60faa7e 100644 --- a/rust/pv/src/uvsecret/secret_list.rs +++ b/rust/pv/src/uvsecret/secret_list.rs @@ -163,6 +163,8 @@ pub enum ListableSecretType { Unknown(u16), } impl ListableSecretType { + const RESERVED_0: u16 = 0x0000; + const NULL: u16 = 0x0001; const ASSOCIATION: u16 = 0x0002; } @@ -179,8 +181,8 @@ impl Display for ListableSecretType { impl From> for ListableSecretType { fn from(value: U16) -> Self { match value.get() { - 0x0000 => Self::Invalid(0), - 0x0001 => Self::Invalid(1), + Self::RESERVED_0 => Self::Invalid(Self::RESERVED_0), + Self::NULL => Self::Invalid(Self::NULL), Self::ASSOCIATION => ListableSecretType::Association, n => Self::Unknown(n), }