From 8c75fcd07c854619fa6f47d74bab039e0dfa5818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Tue, 25 Jun 2024 13:37:35 +0200 Subject: [PATCH] trivial clippy fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabian Grünbichler --- proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs | 6 +++--- src/api2/node/apt.rs | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs b/proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs index 4991479c..20ddfc6b 100644 --- a/proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs +++ b/proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs @@ -100,7 +100,7 @@ impl Bucket { let ty = ty.as_ref(); haystack.iter_mut().find(|b| match b { Bucket::Partition(data) => { - if let Some(comp) = comp.get(0) { + if let Some(comp) = comp.first() { ty == "part" && comp.as_ref().parse::().unwrap() == data.number } else { false @@ -108,14 +108,14 @@ impl Bucket { } Bucket::RawFs(_) => ty == "raw", Bucket::ZPool(data) => { - if let Some(ref comp) = comp.get(0) { + if let Some(ref comp) = comp.first() { ty == "zpool" && comp.as_ref() == data.name } else { false } } Bucket::LVM(data) => { - if let (Some(ref vg), Some(ref lv)) = (comp.get(0), comp.get(1)) { + if let (Some(ref vg), Some(ref lv)) = (comp.first(), comp.get(1)) { ty == "lvm" && vg.as_ref() == data.vg_name && lv.as_ref() == data.lv_name } else { false diff --git a/src/api2/node/apt.rs b/src/api2/node/apt.rs index 9c0d9ecc..0ae353d5 100644 --- a/src/api2/node/apt.rs +++ b/src/api2/node/apt.rs @@ -166,10 +166,7 @@ pub fn apt_update_database( let mut cache = apt::update_cache()?; if notify { - let mut notified = match cache.notified { - Some(notified) => notified, - None => std::collections::HashMap::new(), - }; + let mut notified = cache.notified.unwrap_or_default(); let mut to_notify: Vec<&APTUpdateInfo> = Vec::new(); for pkg in &cache.package_status {