From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <m.sandoval@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 8663490991
 for <pbs-devel@lists.proxmox.com>; Mon, 12 Feb 2024 14:17:37 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 66AA819216
 for <pbs-devel@lists.proxmox.com>; Mon, 12 Feb 2024 14:17:37 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pbs-devel@lists.proxmox.com>; Mon, 12 Feb 2024 14:17:35 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id A6CBF478E6
 for <pbs-devel@lists.proxmox.com>; Mon, 12 Feb 2024 14:17:35 +0100 (CET)
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pbs-devel@lists.proxmox.com
Date: Mon, 12 Feb 2024 14:17:27 +0100
Message-Id: <20240212131734.454966-2-m.sandoval@proxmox.com>
X-Mailer: git-send-email 2.39.2
In-Reply-To: <20240212131734.454966-1-m.sandoval@proxmox.com>
References: <20240212131734.454966-1-m.sandoval@proxmox.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  1
 AWL -0.048 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 FSL_BULK_SIG            0.001 Bulk signature with no Unsubscribe
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RAZOR2_CF_RANGE_51_100  1.886 Razor2 gives confidence level above 50%
 RAZOR2_CHECK            0.922 Listed in Razor2 (http://razor.sf.net/)
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 T_SCC_BODY_TEXT_LINE    -0.01 -
 URIBL_SBL_A 0.1 Contains URL's A record listed in the Spamhaus SBL blocklist
 [185.199.110.153, 185.199.108.153, 185.199.109.153, 185.199.111.153]
Subject: [pbs-devel] [PATCH backup 02/13] remove redundant guards
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Mon, 12 Feb 2024 13:17:37 -0000

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