all lists on 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 02/13] remove redundant guards
Date: Mon, 12 Feb 2024 14:17:27 +0100	[thread overview]
Message-ID: <20240212131734.454966-2-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20240212131734.454966-1-m.sandoval@proxmox.com>

Fixes the clippy lint:

```
warning: redundant guard
   --> pbs-datastore/src/chunk_store.rs:325:37
    |
325 |                     Err(ref err) if err == &nix::errno::Errno::ENOENT => {
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_guards
    = note: `#[warn(clippy::redundant_guards)]` on by default
help: try
    |
325 -                     Err(ref err) if err == &nix::errno::Errno::ENOENT => {
325 +                     Err(nix::errno::Errno::ENOENT) => {
    |
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 pbs-client/src/pxar/extract.rs         | 4 ++--
 pbs-datastore/src/chunk_store.rs       | 2 +-
 src/bin/proxmox_backup_manager/user.rs | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pbs-client/src/pxar/extract.rs b/pbs-client/src/pxar/extract.rs
index af18ecfc..5f5ac618 100644
--- a/pbs-client/src/pxar/extract.rs
+++ b/pbs-client/src/pxar/extract.rs
@@ -699,7 +699,7 @@ impl Extractor {
         if result.seeked_last {
             while match nix::unistd::ftruncate(file.as_raw_fd(), size as i64) {
                 Ok(_) => false,
-                Err(errno) if errno == nix::errno::Errno::EINTR => true,
+                Err(nix::errno::Errno::EINTR) => true,
                 Err(err) => return Err(err).context("error setting file size"),
             } {}
         }
@@ -758,7 +758,7 @@ impl Extractor {
         if result.seeked_last {
             while match nix::unistd::ftruncate(file.as_raw_fd(), size as i64) {
                 Ok(_) => false,
-                Err(errno) if errno == nix::errno::Errno::EINTR => true,
+                Err(nix::errno::Errno::EINTR) => true,
                 Err(err) => return Err(err).context("error setting file size"),
             } {}
         }
diff --git a/pbs-datastore/src/chunk_store.rs b/pbs-datastore/src/chunk_store.rs
index fb282749..9f6289c9 100644
--- a/pbs-datastore/src/chunk_store.rs
+++ b/pbs-datastore/src/chunk_store.rs
@@ -322,7 +322,7 @@ impl ChunkStore {
                         // start reading:
                         continue;
                     }
-                    Err(ref err) if err == &nix::errno::Errno::ENOENT => {
+                    Err(nix::errno::Errno::ENOENT) => {
                         // non-existing directories are okay, just keep going:
                         continue;
                     }
diff --git a/src/bin/proxmox_backup_manager/user.rs b/src/bin/proxmox_backup_manager/user.rs
index 743c5d16..96b83fcc 100644
--- a/src/bin/proxmox_backup_manager/user.rs
+++ b/src/bin/proxmox_backup_manager/user.rs
@@ -16,7 +16,7 @@ fn render_expire(value: &Value, _record: &Value) -> Result<String, Error> {
         return Ok(never);
     }
     let text = match value.as_i64() {
-        Some(epoch) if epoch == 0 => never,
+        Some(0) => never,
         Some(epoch) => {
             if let Ok(epoch_string) = proxmox_time::strftime_local("%c", epoch) {
                 epoch_string
-- 
2.39.2





  reply	other threads:[~2024-02-12 13:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12 13:17 [pbs-devel] [PATCH backup 01/13] docs: remove redundant explicit link target Maximiliano Sandoval
2024-02-12 13:17 ` Maximiliano Sandoval [this message]
2024-02-12 13:17 ` [pbs-devel] [PATCH backup 03/13] remove needless borrows Maximiliano Sandoval
2024-02-12 13:17 ` [pbs-devel] [PATCH backup 04/13] media_catalog: use stream_position Maximiliano Sandoval
2024-02-12 13:17 ` [pbs-devel] [PATCH backup 05/13] use or_default instead of or_insert_with(Default::default) Maximiliano Sandoval
2024-02-12 13:17 ` [pbs-devel] [PATCH backup 06/13] access first element with first() rather than get(0) Maximiliano Sandoval
2024-02-12 13:17 ` [pbs-devel] [PATCH backup 07/13] datastore: use is_{err, some} rather than match {Ok, Some}(_) Maximiliano Sandoval
2024-02-12 13:17 ` [pbs-devel] [PATCH backup 08/13] snapshot_reader: use Rc for structs that are not Send+Sync Maximiliano Sandoval
2024-02-13  9:20   ` Fabian Grünbichler
2024-02-12 13:17 ` [pbs-devel] [PATCH backup 09/13] pxar: elide explicit lifetime Maximiliano Sandoval
2024-02-13  9:04 ` [pbs-devel] [PATCH backup 01/13] docs: remove redundant explicit link target Maximiliano Sandoval
2024-02-13  9:28   ` [pbs-devel] partially-applied: " Fabian Grünbichler

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=20240212131734.454966-2-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal