[pbs-devel] [PATCH proxmox-backup 09/12] tape/*: clippy fixes

Dominik Csapak d.csapak at proxmox.com
Tue Apr 6 08:27:44 CEST 2021


fixes:
* absurd extreme comparisons
* or_fun_call

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/tape/file_formats/multi_volume_writer.rs | 2 +-
 src/tape/inventory.rs                        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/tape/file_formats/multi_volume_writer.rs b/src/tape/file_formats/multi_volume_writer.rs
index d58285e9..8e0e1d94 100644
--- a/src/tape/file_formats/multi_volume_writer.rs
+++ b/src/tape/file_formats/multi_volume_writer.rs
@@ -72,7 +72,7 @@ impl <'a> TapeWrite for MultiVolumeWriter<'a> {
         }
 
         if self.writer.is_none() {
-            if self.header.part_number >= 255 {
+            if self.header.part_number == 255 {
                 proxmox::io_bail!("multi-volume writer: too many parts");
             }
             self.writer = Some(
diff --git a/src/tape/inventory.rs b/src/tape/inventory.rs
index f9654538..15a51e5e 100644
--- a/src/tape/inventory.rs
+++ b/src/tape/inventory.rs
@@ -792,7 +792,7 @@ pub fn lock_media_set(
     path.push(format!(".media-set-{}", media_set_uuid));
     path.set_extension("lck");
 
-    let timeout = timeout.unwrap_or(Duration::new(10, 0));
+    let timeout = timeout.unwrap_or_else(|| Duration::new(10, 0));
     let file = open_file_locked(&path, timeout, true)?;
     if cfg!(test) {
         // We cannot use chown inside test environment (no permissions)
-- 
2.20.1






More information about the pbs-devel mailing list