[pbs-devel] [PATCH backup 04/13] media_catalog: use stream_position
Maximiliano Sandoval
m.sandoval at proxmox.com
Mon Feb 12 14:17:29 CET 2024
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 at 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
More information about the pbs-devel
mailing list