[pbs-devel] [PATCH proxmox-backup 08/12] bin: clippy fixes

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


fixes:
* `len() < 1` => `is_empty()`
* redundant closure
* unnecessary return

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/bin/docgen.rs | 2 +-
 src/bin/pmt.rs    | 2 +-
 src/bin/pmtx.rs   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/bin/docgen.rs b/src/bin/docgen.rs
index 9df9f33b..1f9657ea 100644
--- a/src/bin/docgen.rs
+++ b/src/bin/docgen.rs
@@ -46,7 +46,7 @@ fn main() -> Result<(), Error> {
 
     let (_prefix, args) = get_args();
 
-    if args.len() < 1 {
+    if args.is_empty() {
         bail!("missing arguments");
     }
 
diff --git a/src/bin/pmt.rs b/src/bin/pmt.rs
index a097df2c..b424b045 100644
--- a/src/bin/pmt.rs
+++ b/src/bin/pmt.rs
@@ -781,7 +781,7 @@ fn st_options(
             list
         }
         Some(false) | None => {
-            options.unwrap_or_else(|| Vec::new())
+            options.unwrap_or_else(Vec::new)
         }
     };
 
diff --git a/src/bin/pmtx.rs b/src/bin/pmtx.rs
index 85114811..aef425b4 100644
--- a/src/bin/pmtx.rs
+++ b/src/bin/pmtx.rs
@@ -262,7 +262,7 @@ fn unload(
 
         if let Some(to_slot) = status.find_free_slot(false) {
             sg_pt_changer::unload(&mut file, to_slot, drivenum)?;
-            return Ok(());
+            Ok(())
         } else {
             bail!("Drive '{}' unload failure - no free slot", drivenum);
         }
-- 
2.20.1






More information about the pbs-devel mailing list