[pve-devel] [PATCH proxmox-backup-qemu 2/2] fix clippy warnings

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Nov 24 09:18:13 CET 2021


Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 src/commands.rs | 10 ++--------
 src/restore.rs  |  2 +-
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/commands.rs b/src/commands.rs
index c2a1abb..16dc63f 100644
--- a/src/commands.rs
+++ b/src/commands.rs
@@ -133,7 +133,7 @@ pub(crate) fn check_last_incremental_csum(
 ) -> bool {
 
     match PREVIOUS_CSUMS.lock().unwrap().get(device_name) {
-        Some(csum) => manifest.verify_file(&archive_name(device_name), &csum, device_size).is_ok(),
+        Some(csum) => manifest.verify_file(&archive_name(device_name), csum, device_size).is_ok(),
         None => false,
     }
 }
@@ -203,13 +203,7 @@ pub(crate) async fn register_image(
     let mut initial_index = Arc::new(None);
 
     if incremental {
-        let csum = {
-            let map = PREVIOUS_CSUMS.lock().unwrap();
-            match map.get(&device_name) {
-                Some(c) => Some(*c),
-                None => None
-            }
-        };
+        let csum = PREVIOUS_CSUMS.lock().unwrap().get(&device_name).copied();
 
         if let Some(csum) = csum {
             param["reuse-csum"] = proxmox::tools::digest_to_hex(&csum).into();
diff --git a/src/restore.rs b/src/restore.rs
index 2bc86c9..f70f2ec 100644
--- a/src/restore.rs
+++ b/src/restore.rs
@@ -172,7 +172,7 @@ impl RestoreTask {
                 bytes += index.chunk_size;
                 zeroes += index.chunk_size;
             } else {
-                let raw_data = ReadChunk::read_chunk(&chunk_reader, &digest)?;
+                let raw_data = ReadChunk::read_chunk(&chunk_reader, digest)?;
                 let res = write_data_callback(offset, &raw_data);
                 if res < 0 {
                     bail!("write_data_callback failed ({})", res);
-- 
2.30.2






More information about the pve-devel mailing list