public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH backup v2 4/6] tools: write multiplication by 01 succinctly
Date: Wed, 26 Jun 2024 15:06:01 +0200	[thread overview]
Message-ID: <20240626130603.538973-4-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20240626130603.538973-1-m.sandoval@proxmox.com>

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@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



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel




  parent reply	other threads:[~2024-06-26 13:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-26 13:05 [pbs-devel] [PATCH backup v2 1/6] replace get(key).is_some() with contains_key() Maximiliano Sandoval
2024-06-26 13:05 ` [pbs-devel] [PATCH backup v2 2/6] replace get(key).is_none() with !contains_key() Maximiliano Sandoval
2024-06-26 13:06 ` [pbs-devel] [PATCH backup v2 3/6] api: remove use of unnecessary pub(self) Maximiliano Sandoval
2024-06-26 13:06 ` Maximiliano Sandoval [this message]
2024-06-26 13:06 ` [pbs-devel] [PATCH backup v2 5/6] chunk_store: do not explicitly write implied trait Maximiliano Sandoval
2024-06-26 13:06 ` [pbs-devel] [PATCH backup v2 6/6] tools: add missing cfg(test) macro Maximiliano Sandoval
2024-06-28  7:36 ` [pbs-devel] applied-series: [PATCH backup v2 1/6] replace get(key).is_some() with contains_key() Wolfgang Bumiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240626130603.538973-4-m.sandoval@proxmox.com \
    --to=m.sandoval@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal