From 3f694b5481e6cb424f50848cd12999c0ff348b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Wed, 20 Jul 2022 13:07:18 +0200 Subject: [PATCH] subscription: clippy lints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabian Grünbichler --- proxmox-subscription/src/subscription_info.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/proxmox-subscription/src/subscription_info.rs b/proxmox-subscription/src/subscription_info.rs index bce90e80..1b2a301f 100644 --- a/proxmox-subscription/src/subscription_info.rs +++ b/proxmox-subscription/src/subscription_info.rs @@ -102,8 +102,7 @@ impl SubscriptionInfo { .as_object_mut() .ok_or_else(|| format_err!("subscription info not a JSON object"))? .remove("signature") - .map(|v| v.as_str().map(|v| v.to_owned())) - .flatten(); + .and_then(|v| v.as_str().map(|v| v.to_owned())); if self.is_signed() && signature.is_none() { bail!("Failed to extract signature value!"); @@ -188,7 +187,7 @@ impl SubscriptionInfo { } (None, _) => { self.status = SubscriptionStatus::Invalid; - self.message = Some(format!("Missing server ID.")); + self.message = Some("Missing server ID.".to_string()); self.signature = None; } (Some(contained), Ok(expected)) if &expected != contained => { @@ -217,7 +216,7 @@ impl SubscriptionInfo { }; if self.is_signed() { - if let Err(err) = verify(&self) { + if let Err(err) = verify(self) { self.status = SubscriptionStatus::Invalid; self.message = Some(format!("Signature validation failed - {err}")); } @@ -242,7 +241,7 @@ pub fn get_hardware_address() -> Result { } fn parse_next_due(value: &str) -> Result { - let mut components = value.split("-"); + let mut components = value.split('-'); let year = components .next() .ok_or_else(|| format_err!("missing year component."))?