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 375E8909D1
 for <pbs-devel@lists.proxmox.com>; Mon, 12 Feb 2024 14:18:07 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 18A24191FC
 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:36 +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 0FEB0478EC
 for <pbs-devel@lists.proxmox.com>; Mon, 12 Feb 2024 14:17:36 +0100 (CET)
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pbs-devel@lists.proxmox.com
Date: Mon, 12 Feb 2024 14:17:29 +0100
Message-Id: <20240212131734.454966-4-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.111.153, 185.199.109.153, 185.199.108.153, 185.199.110.153]
Subject: [pbs-devel] [PATCH backup 04/13] media_catalog: use stream_position
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:18:07 -0000

Fixes the following clippy lint:

```
warning: using `SeekFrom::Current` to start from current position
   --> src/tape/media_catalog.rs:798:23
    |
798 |             let pos = file.seek(SeekFrom::Current(0))?; // get current pos
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `file.stream_position()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#seek_from_current
    = note: `#[warn(clippy::seek_from_current)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 src/tape/media_catalog.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/tape/media_catalog.rs b/src/tape/media_catalog.rs
index 928d4701..9aae0aa1 100644
--- a/src/tape/media_catalog.rs
+++ b/src/tape/media_catalog.rs
@@ -1,6 +1,6 @@
 use std::collections::{HashMap, HashSet};
 use std::fs::File;
-use std::io::{BufReader, Read, Seek, SeekFrom, Write};
+use std::io::{BufReader, Read, Seek, Write};
 use std::os::unix::io::AsRawFd;
 use std::path::{Path, PathBuf};
 
@@ -795,7 +795,7 @@ impl MediaCatalog {
         let mut media_set_uuid = None;
 
         loop {
-            let pos = file.seek(SeekFrom::Current(0))?; // get current pos
+            let pos = file.stream_position()?; // get current pos
 
             if pos == 0 {
                 // read/check magic number
-- 
2.39.2