[pbs-devel] [PATCH backup v2 4/6] tools: write multiplication by 01 succinctly

Maximiliano Sandoval m.sandoval at proxmox.com
Wed Jun 26 15:06:01 CEST 2024


Fixes the clippy warning:

warning: this multiplication by -1 can be written more succinctly
   --> pbs-client/src/tools/mod.rs:700:58
    |
700 |                         SignedDuration::Negative(val) => -1 * i64::try_from(val.as_secs())?,
    |                                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `-i64::try_from(val.as_secs())?`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#neg_multiply
    = note: `#[warn(clippy::neg_multiply)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
 pbs-client/src/tools/mod.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pbs-client/src/tools/mod.rs b/pbs-client/src/tools/mod.rs
index 782e0578..90fac696 100644
--- a/pbs-client/src/tools/mod.rs
+++ b/pbs-client/src/tools/mod.rs
@@ -697,7 +697,7 @@ pub async fn pxar_metadata_catalog_lookup<T: Clone + ReadAt>(
                 EntryKind::File { size, .. } => {
                     let mtime = match entry.metadata().mtime_as_duration() {
                         SignedDuration::Positive(val) => i64::try_from(val.as_secs())?,
-                        SignedDuration::Negative(val) => -1 * i64::try_from(val.as_secs())?,
+                        SignedDuration::Negative(val) => -i64::try_from(val.as_secs())?,
                     };
                     DirEntryAttribute::File { size: *size, mtime }
                 }
-- 
2.39.2





More information about the pbs-devel mailing list