public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH backup 01/13] remove needless borrows
@ 2024-12-02  9:57 Maximiliano Sandoval
  2024-12-02  9:57 ` [pbs-devel] [PATCH backup 02/13] use inspect_err when possible Maximiliano Sandoval
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: Maximiliano Sandoval @ 2024-12-02  9:57 UTC (permalink / raw)
  To: pbs-devel

Fixes the needless_borrow lint.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 pbs-client/src/catalog_shell.rs      | 6 +++---
 pbs-datastore/src/backup_info.rs     | 2 +-
 pbs-datastore/src/datastore.rs       | 2 +-
 proxmox-backup-client/src/catalog.rs | 4 ++--
 proxmox-backup-client/src/main.rs    | 4 +---
 src/api2/node/apt.rs                 | 2 +-
 src/api2/node/disks/zfs.rs           | 2 +-
 src/tools/disks/mod.rs               | 4 ++--
 8 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/pbs-client/src/catalog_shell.rs b/pbs-client/src/catalog_shell.rs
index 7dace86bb..550daf56b 100644
--- a/pbs-client/src/catalog_shell.rs
+++ b/pbs-client/src/catalog_shell.rs
@@ -529,7 +529,7 @@ impl Shell {
                         None => bail!("no such file or directory: {entry:?}"),
                     }
                 } else {
-                    let pxar_entry = parent_pxar_entry(&stack)?;
+                    let pxar_entry = parent_pxar_entry(stack)?;
                     let parent_dir = pxar_entry.enter_directory().await?;
                     match parent_dir.lookup(entry).await? {
                         Some(entry) => {
@@ -575,7 +575,7 @@ impl Shell {
                         None => bail!("no such file or directory: {:?}", entry),
                     }
                 } else {
-                    let pxar_entry = parent_pxar_entry(&stack)?;
+                    let pxar_entry = parent_pxar_entry(stack)?;
                     let parent_dir = block_on(pxar_entry.enter_directory())?;
                     match block_on(parent_dir.lookup(entry))? {
                         Some(entry) => {
@@ -766,7 +766,7 @@ impl Shell {
                 let mut out = std::io::stdout();
                 let items = crate::pxar::tools::pxar_metadata_read_dir(dir).await?;
                 for item in items {
-                    out.write_all(&item.file_name().as_bytes())?;
+                    out.write_all(item.file_name().as_bytes())?;
                     out.write_all(b"\n")?;
                 }
                 return Ok(());
diff --git a/pbs-datastore/src/backup_info.rs b/pbs-datastore/src/backup_info.rs
index be262773b..a92c47821 100644
--- a/pbs-datastore/src/backup_info.rs
+++ b/pbs-datastore/src/backup_info.rs
@@ -428,7 +428,7 @@ impl BackupDir {
 
         std::fs::create_dir_all(&path)?;
         let ts = self.backup_time_string();
-        path.push(&format!("{ts}{MANIFEST_LOCK_NAME}"));
+        path.push(format!("{ts}{MANIFEST_LOCK_NAME}"));
 
         Ok(path)
     }
diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index 4c062e244..24d9eab2e 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -1151,7 +1151,7 @@ impl DataStore {
             let _exclusive_lock = self.inner.chunk_store.try_exclusive_lock()?;
 
             let (config, _digest) = pbs_config::datastore::config()?;
-            let gc_store_config: DataStoreConfig = config.lookup("datastore", &self.name())?;
+            let gc_store_config: DataStoreConfig = config.lookup("datastore", self.name())?;
             let all_stores = config.convert_to_typed_array("datastore")?;
             if let Err(err) = gc_store_config.ensure_not_nested(&all_stores) {
                 info!(
diff --git a/proxmox-backup-client/src/catalog.rs b/proxmox-backup-client/src/catalog.rs
index 0e20886a0..7173c8efc 100644
--- a/proxmox-backup-client/src/catalog.rs
+++ b/proxmox-backup-client/src/catalog.rs
@@ -240,7 +240,7 @@ async fn catalog_shell(param: Value) -> Result<(), Error> {
         )
         .await?;
 
-        let state = Shell::new(None, &server_archive_name.as_ref(), accessor).await?;
+        let state = Shell::new(None, server_archive_name.as_ref(), accessor).await?;
         log::info!("Starting interactive shell");
         state.shell().await?;
         record_repository(&repo);
@@ -283,7 +283,7 @@ async fn catalog_shell(param: Value) -> Result<(), Error> {
 
     catalogfile.seek(SeekFrom::Start(0))?;
     let catalog_reader = CatalogReader::new(catalogfile);
-    let state = Shell::new(Some(catalog_reader), &server_archive_name.as_ref(), decoder).await?;
+    let state = Shell::new(Some(catalog_reader), server_archive_name.as_ref(), decoder).await?;
 
     log::info!("Starting interactive shell");
     state.shell().await?;
diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs
index 89f91e2b5..580feb626 100644
--- a/proxmox-backup-client/src/main.rs
+++ b/proxmox-backup-client/src/main.rs
@@ -1017,9 +1017,7 @@ async fn create_backup(
             (BackupSpecificationType::PXAR, true) => {
                 log_file("directory", &filename, target.as_ref())
             }
-            (BackupSpecificationType::IMAGE, true) => {
-                log_file("image", &filename, &target.as_ref())
-            }
+            (BackupSpecificationType::IMAGE, true) => log_file("image", &filename, target.as_ref()),
             // no dry-run
             (BackupSpecificationType::CONFIG, false) => {
                 let upload_options = UploadOptions {
diff --git a/src/api2/node/apt.rs b/src/api2/node/apt.rs
index 672ef7bf7..8be6ee261 100644
--- a/src/api2/node/apt.rs
+++ b/src/api2/node/apt.rs
@@ -181,7 +181,7 @@ pub fn get_versions() -> Result<Vec<APTUpdateInfo>, Error> {
         "proxmox-backup",
         "proxmox-backup-server",
         &running_daemon_version,
-        &PACKAGES,
+        PACKAGES,
     )
 }
 
diff --git a/src/api2/node/disks/zfs.rs b/src/api2/node/disks/zfs.rs
index a31320c54..b6cf18265 100644
--- a/src/api2/node/disks/zfs.rs
+++ b/src/api2/node/disks/zfs.rs
@@ -290,7 +290,7 @@ pub fn create_zpool(
             let mut command = std::process::Command::new("zfs");
             command.arg("set");
             if let Some(compression) = compression {
-                command.arg(&format!("compression={}", compression));
+                command.arg(format!("compression={compression}"));
             }
             command.args(["relatime=on", &name]);
             info!("# {command:?}");
diff --git a/src/tools/disks/mod.rs b/src/tools/disks/mod.rs
index 61aceccd6..571446db2 100644
--- a/src/tools/disks/mod.rs
+++ b/src/tools/disks/mod.rs
@@ -1215,7 +1215,7 @@ pub fn change_parttype(part_disk: &Disk, part_type: &str) -> Result<(), Error> {
         let minor = unsafe { libc::minor(stat.st_rdev) };
         let partnum_path = &format!("/sys/dev/block/{}:{}/partition", major, minor);
         let partnum: u32 = std::fs::read_to_string(partnum_path)?.trim_end().parse()?;
-        sgdisk_command.arg(&format!("-t{}:{}", partnum, part_type));
+        sgdisk_command.arg(format!("-t{}:{}", partnum, part_type));
         let part_disk_parent = match part_disk.parent() {
             Some(disk) => disk,
             None => bail!("disk {:?} has no node in /dev", part_disk.syspath()),
@@ -1355,7 +1355,7 @@ pub fn get_fs_uuid(disk: &Disk) -> Result<String, Error> {
 /// Mount a disk by its UUID and the mount point.
 pub fn mount_by_uuid(uuid: &str, mount_point: &Path) -> Result<(), Error> {
     let mut command = std::process::Command::new("mount");
-    command.arg(&format!("UUID={uuid}"));
+    command.arg(format!("UUID={uuid}"));
     command.arg(mount_point);
 
     proxmox_sys::command::run_command(command, None)?;
-- 
2.39.5



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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [pbs-devel] [PATCH backup 02/13] use inspect_err when possible
  2024-12-02  9:57 [pbs-devel] [PATCH backup 01/13] remove needless borrows Maximiliano Sandoval
@ 2024-12-02  9:57 ` Maximiliano Sandoval
  2024-12-02  9:57 ` [pbs-devel] [PATCH backup 03/13] backup_manager: use Vec::first instead of get(0) Maximiliano Sandoval
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Maximiliano Sandoval @ 2024-12-02  9:57 UTC (permalink / raw)
  To: pbs-devel

Fixes the manual_inspect clippy lint:

```
warning: using `map_err` over `inspect_err`
   --> src/bin/proxmox_backup_debug/diff.rs:125:18
    |
125 |                 .map_err(|err| {
    |                  ^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_inspect
    = note: `#[warn(clippy::manual_inspect)]` on by default
help: try
    |
125 ~                 .inspect_err(|err| {
126 ~                     log::error!("{}", format_key_source(&key.source, "encryption"));
    |
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxmox-backup-client/src/catalog.rs | 6 ++----
 proxmox-backup-client/src/main.rs    | 3 +--
 proxmox-file-restore/src/main.rs     | 6 ++----
 src/bin/proxmox_backup_debug/diff.rs | 3 +--
 4 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/proxmox-backup-client/src/catalog.rs b/proxmox-backup-client/src/catalog.rs
index 7173c8efc..473214c35 100644
--- a/proxmox-backup-client/src/catalog.rs
+++ b/proxmox-backup-client/src/catalog.rs
@@ -65,9 +65,8 @@ async fn dump_catalog(param: Value) -> Result<Value, Error> {
         None => None,
         Some(key) => {
             let (key, _created, _fingerprint) = decrypt_key(&key.key, &get_encryption_key_password)
-                .map_err(|err| {
+                .inspect_err(|_err| {
                     log::error!("{}", format_key_source(&key.source, "encryption"));
-                    err
                 })?;
             let crypt_config = CryptConfig::new(key)?;
             Some(Arc::new(crypt_config))
@@ -204,9 +203,8 @@ async fn catalog_shell(param: Value) -> Result<(), Error> {
         None => None,
         Some(key) => {
             let (key, _created, _fingerprint) = decrypt_key(&key.key, &get_encryption_key_password)
-                .map_err(|err| {
+                .inspect_err(|_err| {
                     log::error!("{}", format_key_source(&key.source, "encryption"));
-                    err
                 })?;
             let crypt_config = CryptConfig::new(key)?;
             Some(Arc::new(crypt_config))
diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs
index 580feb626..c9be952ad 100644
--- a/proxmox-backup-client/src/main.rs
+++ b/proxmox-backup-client/src/main.rs
@@ -1543,9 +1543,8 @@ async fn restore(
         None => None,
         Some(ref key) => {
             let (key, _, _) =
-                decrypt_key(&key.key, &get_encryption_key_password).map_err(|err| {
+                decrypt_key(&key.key, &get_encryption_key_password).inspect_err(|_err| {
                     log::error!("{}", format_key_source(&key.source, "encryption"));
-                    err
                 })?;
             Some(Arc::new(CryptConfig::new(key)?))
         }
diff --git a/proxmox-file-restore/src/main.rs b/proxmox-file-restore/src/main.rs
index 0a60d69f6..bbfc6eb4e 100644
--- a/proxmox-file-restore/src/main.rs
+++ b/proxmox-file-restore/src/main.rs
@@ -291,9 +291,8 @@ async fn list(
         None => None,
         Some(ref key) => {
             let (key, _, _) =
-                decrypt_key(&key.key, &get_encryption_key_password).map_err(|err| {
+                decrypt_key(&key.key, &get_encryption_key_password).inspect_err(|_err| {
                     log::error!("{}", format_key_source(&key.source, "encryption"));
-                    err
                 })?;
             Some(Arc::new(CryptConfig::new(key)?))
         }
@@ -455,9 +454,8 @@ async fn extract(
         None => None,
         Some(ref key) => {
             let (key, _, _) =
-                decrypt_key(&key.key, &get_encryption_key_password).map_err(|err| {
+                decrypt_key(&key.key, &get_encryption_key_password).inspect_err(|_err| {
                     log::error!("{}", format_key_source(&key.source, "encryption"));
-                    err
                 })?;
             Some(Arc::new(CryptConfig::new(key)?))
         }
diff --git a/src/bin/proxmox_backup_debug/diff.rs b/src/bin/proxmox_backup_debug/diff.rs
index dcd351d93..02389d0e5 100644
--- a/src/bin/proxmox_backup_debug/diff.rs
+++ b/src/bin/proxmox_backup_debug/diff.rs
@@ -122,9 +122,8 @@ async fn diff_archive_cmd(
         None => None,
         Some(key) => {
             let (key, _created, _fingerprint) = decrypt_key(&key.key, &get_encryption_key_password)
-                .map_err(|err| {
+                .inspect_err(|_err| {
                     log::error!("{}", format_key_source(&key.source, "encryption"));
-                    err
                 })?;
             let crypt_config = CryptConfig::new(key)?;
             Some(Arc::new(crypt_config))
-- 
2.39.5



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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [pbs-devel] [PATCH backup 03/13] backup_manager: use Vec::first instead of get(0)
  2024-12-02  9:57 [pbs-devel] [PATCH backup 01/13] remove needless borrows Maximiliano Sandoval
  2024-12-02  9:57 ` [pbs-devel] [PATCH backup 02/13] use inspect_err when possible Maximiliano Sandoval
@ 2024-12-02  9:57 ` Maximiliano Sandoval
  2024-12-02  9:57 ` [pbs-devel] [PATCH backup 04/13] push: use unwrap_or to prevent lazy evaluation Maximiliano Sandoval
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Maximiliano Sandoval @ 2024-12-02  9:57 UTC (permalink / raw)
  To: pbs-devel

Fixes the get_first clippy lint:

```
warning: accessing first element with `matching_stores.get(0)`
   --> src/bin/proxmox_backup_manager/datastore.rs:284:26
    |
284 |     if let Some(store) = matching_stores.get(0) {
    |                          ^^^^^^^^^^^^^^^^^^^^^^ help: try: `matching_stores.first()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
    = note: `#[warn(clippy::get_first)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 src/bin/proxmox_backup_manager/datastore.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/proxmox_backup_manager/datastore.rs b/src/bin/proxmox_backup_manager/datastore.rs
index 8711997de..0918af3a4 100644
--- a/src/bin/proxmox_backup_manager/datastore.rs
+++ b/src/bin/proxmox_backup_manager/datastore.rs
@@ -281,7 +281,7 @@ async fn uuid_mount(param: Value, _rpcenv: &mut dyn RpcEnvironment) -> Result<Va
         return Ok(Value::Null);
     }
 
-    if let Some(store) = matching_stores.get(0) {
+    if let Some(store) = matching_stores.first() {
         api2::admin::datastore::do_mount_device(store.clone())?;
     }
 
-- 
2.39.5



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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [pbs-devel] [PATCH backup 04/13] push: use unwrap_or to prevent lazy evaluation
  2024-12-02  9:57 [pbs-devel] [PATCH backup 01/13] remove needless borrows Maximiliano Sandoval
  2024-12-02  9:57 ` [pbs-devel] [PATCH backup 02/13] use inspect_err when possible Maximiliano Sandoval
  2024-12-02  9:57 ` [pbs-devel] [PATCH backup 03/13] backup_manager: use Vec::first instead of get(0) Maximiliano Sandoval
@ 2024-12-02  9:57 ` Maximiliano Sandoval
  2024-12-02  9:58 ` [pbs-devel] [PATCH backup 05/13] docs: use sublist indentation Maximiliano Sandoval
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Maximiliano Sandoval @ 2024-12-02  9:57 UTC (permalink / raw)
  To: pbs-devel

Fixes the unnecessary_lazy_evaluations clippy lint:

```
warning: unnecessary closure used to substitute value for `Option::None`
   --> src/server/push.rs:445:25
    |
445 |           let max_depth = params
    |  _________________________^
446 | |             .max_depth
447 | |             .unwrap_or_else(|| pbs_api_types::MAX_NAMESPACE_DEPTH);
    | |__________________________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
    = note: `#[warn(clippy::unnecessary_lazy_evaluations)]` on by default
help: use `unwrap_or` instead
    |
447 |             .unwrap_or(pbs_api_types::MAX_NAMESPACE_DEPTH);
    |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 src/server/push.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/server/push.rs b/src/server/push.rs
index 8f654d4b4..b2639526b 100644
--- a/src/server/push.rs
+++ b/src/server/push.rs
@@ -444,7 +444,7 @@ pub(crate) async fn push_store(mut params: PushParameters) -> Result<SyncStats,
         // Without this pre-filtering, all namespaces unrelated to the sync would be removed!
         let max_depth = params
             .max_depth
-            .unwrap_or_else(|| pbs_api_types::MAX_NAMESPACE_DEPTH);
+            .unwrap_or(pbs_api_types::MAX_NAMESPACE_DEPTH);
         let mut target_sub_namespaces: Vec<BackupNamespace> = existing_target_namespaces
             .into_iter()
             .filter(|target_namespace| {
-- 
2.39.5



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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [pbs-devel] [PATCH backup 05/13] docs: use sublist indentation
  2024-12-02  9:57 [pbs-devel] [PATCH backup 01/13] remove needless borrows Maximiliano Sandoval
                   ` (2 preceding siblings ...)
  2024-12-02  9:57 ` [pbs-devel] [PATCH backup 04/13] push: use unwrap_or to prevent lazy evaluation Maximiliano Sandoval
@ 2024-12-02  9:58 ` Maximiliano Sandoval
  2024-12-02  9:58 ` [pbs-devel] [PATCH backup 06/13] client: remove unnecessary deref Maximiliano Sandoval
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Maximiliano Sandoval @ 2024-12-02  9:58 UTC (permalink / raw)
  To: pbs-devel

Fixes the doc_lazy_continuation clippy lint, e.g.:

```
warning: doc list item without indentation
   --> src/server/pull.rs:764:5
    |
764 | /// -- attempt to pull each NS in turn
    |     ^
    |
    = help: if this is supposed to be its own paragraph, add a blank line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
help: indent this line
    |
764 | ///   -- attempt to pull each NS in turn
    |     ++
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 pbs-client/src/pxar/mod.rs |  2 +-
 pbs-config/src/acl.rs      |  4 ++--
 src/server/pull.rs         | 16 ++++++++--------
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/pbs-client/src/pxar/mod.rs b/pbs-client/src/pxar/mod.rs
index 661501782..c55c942b7 100644
--- a/pbs-client/src/pxar/mod.rs
+++ b/pbs-client/src/pxar/mod.rs
@@ -32,7 +32,7 @@
 //!
 //!   * `FILENAME`          -- name of the first directory entry (strictly ordered!)
 //!   * `<archive>`         -- serialization of the first directory entry's metadata and contents,
-//!  following the exact same archive format
+//!     following the exact same archive format
 //!   * `FILENAME`          -- name of the second directory entry (strictly ordered!)
 //!   * `<archive>`         -- serialization of the second directory entry
 //!   * ...
diff --git a/pbs-config/src/acl.rs b/pbs-config/src/acl.rs
index a06b918ad..d8138078c 100644
--- a/pbs-config/src/acl.rs
+++ b/pbs-config/src/acl.rs
@@ -646,8 +646,8 @@ impl AclTree {
     /// - iterate over all intermediate nodes along `path` and collect roles with `propagate` set
     /// - get all (propagating and non-propagating) roles for last component of path
     /// - more specific role maps replace less specific role maps
-    /// -- user/token is more specific than group at each level
-    /// -- roles lower in the tree are more specific than those higher up along the path
+    ///   -- user/token is more specific than group at each level
+    ///   -- roles lower in the tree are more specific than those higher up along the path
     pub fn roles(&self, auth_id: &Authid, path: &[&str]) -> HashMap<String, bool> {
         let mut node = &self.root;
         let mut role_map = node.extract_roles(auth_id, path.is_empty());
diff --git a/src/server/pull.rs b/src/server/pull.rs
index 361ed0687..516abfe5d 100644
--- a/src/server/pull.rs
+++ b/src/server/pull.rs
@@ -246,8 +246,8 @@ fn verify_archive(info: &FileInfo, csum: &[u8; 32], size: u64) -> Result<(), Err
 ///
 /// Pulling an archive consists of the following steps:
 /// - Load archive file into tmp file
-/// -- Load file into tmp file
-/// -- Verify tmp file checksum
+///   -- Load file into tmp file
+///   -- Verify tmp file checksum
 /// - if archive is an index, pull referenced chunks
 /// - Rename tmp file into real path
 async fn pull_single_archive<'a>(
@@ -328,10 +328,10 @@ async fn pull_single_archive<'a>(
 ///
 /// Pulling a snapshot consists of the following steps:
 /// - (Re)download the manifest
-/// -- if it matches and is not corrupt, only download log and treat snapshot as already synced
+///   -- if it matches and is not corrupt, only download log and treat snapshot as already synced
 /// - Iterate over referenced files
-/// -- if file already exists, verify contents
-/// -- if not, pull it from the remote
+///   -- if file already exists, verify contents
+///   -- if not, pull it from the remote
 /// - Download log if not already existing
 async fn pull_snapshot<'a>(
     reader: Arc<dyn SyncSourceReader + 'a>,
@@ -495,7 +495,7 @@ async fn pull_snapshot_from<'a>(
 /// - Sort by snapshot time
 /// - Get last snapshot timestamp on local datastore
 /// - Iterate over list of snapshots
-/// -- pull snapshot, unless it's not finished yet or older than last local snapshot
+///   -- pull snapshot, unless it's not finished yet or older than last local snapshot
 /// - (remove_vanished) list all local snapshots, remove those that don't exist on remote
 ///
 /// Backwards-compat: if `source_namespace` is [None], only the group type and ID will be sent to the
@@ -760,8 +760,8 @@ fn check_and_remove_vanished_ns(
 /// Pulling a store consists of the following steps:
 /// - Query list of namespaces on the remote
 /// - Iterate list
-/// -- create sub-NS if needed (and allowed)
-/// -- attempt to pull each NS in turn
+///   -- create sub-NS if needed (and allowed)
+///   -- attempt to pull each NS in turn
 /// - (remove_vanished && max_depth > 0) remove sub-NS which are not or no longer available on the remote
 ///
 /// Backwards compat: if the remote namespace is `/` and recursion is disabled, no namespace is
-- 
2.39.5



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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [pbs-devel] [PATCH backup 06/13] client: remove unnecessary deref
  2024-12-02  9:57 [pbs-devel] [PATCH backup 01/13] remove needless borrows Maximiliano Sandoval
                   ` (3 preceding siblings ...)
  2024-12-02  9:58 ` [pbs-devel] [PATCH backup 05/13] docs: use sublist indentation Maximiliano Sandoval
@ 2024-12-02  9:58 ` Maximiliano Sandoval
  2024-12-02  9:58 ` [pbs-devel] [PATCH backup 07/13] remove needless type conversion Maximiliano Sandoval
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Maximiliano Sandoval @ 2024-12-02  9:58 UTC (permalink / raw)
  To: pbs-devel

Fixes the needless_option_as_deref clippy lint:

```
warning: derefed type is same as origin
    --> proxmox-backup-client/src/main.rs:1154:21
     |
1154 |                     payload_target.as_ref().as_deref(),
     |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `payload_target.as_ref()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_option_as_deref
     = note: `#[warn(clippy::needless_option_as_deref)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxmox-backup-client/src/main.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs
index c9be952ad..b0d45f89e 100644
--- a/proxmox-backup-client/src/main.rs
+++ b/proxmox-backup-client/src/main.rs
@@ -1149,7 +1149,7 @@ async fn create_backup(
                     &client,
                     &filename,
                     &target,
-                    payload_target.as_ref().as_deref(),
+                    payload_target.as_ref(),
                     chunk_size_opt,
                     catalog.as_ref().cloned(),
                     pxar_options,
-- 
2.39.5



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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [pbs-devel] [PATCH backup 07/13] remove needless type conversion
  2024-12-02  9:57 [pbs-devel] [PATCH backup 01/13] remove needless borrows Maximiliano Sandoval
                   ` (4 preceding siblings ...)
  2024-12-02  9:58 ` [pbs-devel] [PATCH backup 06/13] client: remove unnecessary deref Maximiliano Sandoval
@ 2024-12-02  9:58 ` Maximiliano Sandoval
  2024-12-02  9:58 ` [pbs-devel] [PATCH backup 08/13] client: catalog: remove unnecessary sort_unstable_by Maximiliano Sandoval
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Maximiliano Sandoval @ 2024-12-02  9:58 UTC (permalink / raw)
  To: pbs-devel

The mount types were probably here for compatibility with older proxmox-sys.

Fixes the useless_conversion clippy lints:

```
warning: useless conversion to the same type: `std::os::fd::OwnedFd`
   --> proxmox-backup-client/src/mount.rs:172:23
    |
172 |     let pr: OwnedFd = pr.into(); // until next sys bump
    |                       ^^^^^^^^^ help: consider removing `.into()`: `pr`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
    = note: `#[warn(clippy::useless_conversion)]` on by default

warning: useless conversion to the same type: `std::os::fd::OwnedFd`
   --> proxmox-backup-client/src/mount.rs:173:23
    |
173 |     let pw: OwnedFd = pw.into();
    |                       ^^^^^^^^^ help: consider removing `.into()`: `pw`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

warning: useless conversion to the same type: `pbs_api_types::BackupArchiveName`
   --> proxmox-file-restore/src/main.rs:484:18
    |
484 |                 &archive_name.try_into()?,
    |                  ^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: consider removing `.try_into()`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
    = note: `#[warn(clippy::useless_conversion)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxmox-backup-client/src/mount.rs | 2 --
 proxmox-file-restore/src/main.rs   | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/proxmox-backup-client/src/mount.rs b/proxmox-backup-client/src/mount.rs
index 0048a8ad4..4929f5e5d 100644
--- a/proxmox-backup-client/src/mount.rs
+++ b/proxmox-backup-client/src/mount.rs
@@ -169,8 +169,6 @@ fn mount(
     // Process should be daemonized.
     // Make sure to fork before the async runtime is instantiated to avoid troubles.
     let (pr, pw) = proxmox_sys::pipe()?;
-    let pr: OwnedFd = pr.into(); // until next sys bump
-    let pw: OwnedFd = pw.into();
     match unsafe { fork() } {
         Ok(ForkResult::Parent { .. }) => {
             drop(pw);
diff --git a/proxmox-file-restore/src/main.rs b/proxmox-file-restore/src/main.rs
index bbfc6eb4e..59ccbe524 100644
--- a/proxmox-file-restore/src/main.rs
+++ b/proxmox-file-restore/src/main.rs
@@ -479,7 +479,7 @@ async fn extract(
             let (archive_name, payload_archive_name) =
                 pbs_client::tools::get_pxar_archive_names(&archive_name, &manifest)?;
             let (reader, archive_size) = get_remote_pxar_reader(
-                &archive_name.try_into()?,
+                &archive_name,
                 client.clone(),
                 &manifest,
                 crypt_config.clone(),
-- 
2.39.5



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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [pbs-devel] [PATCH backup 08/13] client: catalog: remove unnecessary sort_unstable_by
  2024-12-02  9:57 [pbs-devel] [PATCH backup 01/13] remove needless borrows Maximiliano Sandoval
                   ` (5 preceding siblings ...)
  2024-12-02  9:58 ` [pbs-devel] [PATCH backup 07/13] remove needless type conversion Maximiliano Sandoval
@ 2024-12-02  9:58 ` Maximiliano Sandoval
  2024-12-02  9:58 ` [pbs-devel] [PATCH backup 09/13] docs: fix outer docs comments Maximiliano Sandoval
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Maximiliano Sandoval @ 2024-12-02  9:58 UTC (permalink / raw)
  To: pbs-devel

Fixes the unnecessary_sort_by clippy lint:

```
warning: consider using `sort`
   --> proxmox-backup-client/src/catalog.rs:102:13
    |
102 |             metadata_archives.sort_unstable_by(|a, b| a.cmp(b));
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `metadata_archives.sort_unstable()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by
    = note: `#[warn(clippy::unnecessary_sort_by)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxmox-backup-client/src/catalog.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxmox-backup-client/src/catalog.rs b/proxmox-backup-client/src/catalog.rs
index 473214c35..b1b22ff24 100644
--- a/proxmox-backup-client/src/catalog.rs
+++ b/proxmox-backup-client/src/catalog.rs
@@ -98,7 +98,7 @@ async fn dump_catalog(param: Value) -> Result<Value, Error> {
                     metadata_archives.push(archive.filename.clone());
                 }
             }
-            metadata_archives.sort_unstable_by(|a, b| a.cmp(b));
+            metadata_archives.sort_unstable();
 
             for archive in &metadata_archives {
                 let (reader, archive_size) = get_remote_pxar_reader(
-- 
2.39.5



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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [pbs-devel] [PATCH backup 09/13] docs: fix outer docs comments
  2024-12-02  9:57 [pbs-devel] [PATCH backup 01/13] remove needless borrows Maximiliano Sandoval
                   ` (6 preceding siblings ...)
  2024-12-02  9:58 ` [pbs-devel] [PATCH backup 08/13] client: catalog: remove unnecessary sort_unstable_by Maximiliano Sandoval
@ 2024-12-02  9:58 ` Maximiliano Sandoval
  2024-12-02  9:58 ` [pbs-devel] [PATCH backup 10/13] remove redundant imports Maximiliano Sandoval
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Maximiliano Sandoval @ 2024-12-02  9:58 UTC (permalink / raw)
  To: pbs-devel

Fixes the suspicious_doc_comments clippy lints:

```
warning: this is an outer doc comment and does not apply to the parent module or crate
 --> proxmox-restore-daemon/src/main.rs:1:1
  |
1 | ///! Daemon binary to run inside a micro-VM for secure single file restore of disk images
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_doc_comments
  = note: `#[warn(clippy::suspicious_doc_comments)]` on by default
help: use an inner doc comment to document the parent module or crate
  |
1 | //! Daemon binary to run inside a micro-VM for secure single file restore of disk images
  |

warning: this is an outer doc comment and does not apply to the parent module or crate
 --> proxmox-restore-daemon/src/proxmox_restore_daemon/mod.rs:1:1
  |
1 | ///! File restore VM related functionality
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_doc_comments
help: use an inner doc comment to document the parent module or crate
  |
1 | //! File restore VM related functionality
  |

warning: this is an outer doc comment and does not apply to the parent module or crate
 --> proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs:1:1
  |
1 | ///! File-restore API running inside the restore VM
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_doc_comments
help: use an inner doc comment to document the parent module or crate
  |
1 | //! File-restore API running inside the restore VM
  |
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxmox-restore-daemon/src/main.rs                       | 2 +-
 proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs | 2 +-
 proxmox-restore-daemon/src/proxmox_restore_daemon/mod.rs | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/proxmox-restore-daemon/src/main.rs b/proxmox-restore-daemon/src/main.rs
index 0131d771b..7f61faed8 100644
--- a/proxmox-restore-daemon/src/main.rs
+++ b/proxmox-restore-daemon/src/main.rs
@@ -1,4 +1,4 @@
-///! Daemon binary to run inside a micro-VM for secure single file restore of disk images
+//! Daemon binary to run inside a micro-VM for secure single file restore of disk images
 use std::fs::File;
 use std::io::prelude::*;
 use std::os::unix::{
diff --git a/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs b/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs
index 6c27a8861..8955772bc 100644
--- a/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs
+++ b/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs
@@ -1,4 +1,4 @@
-///! File-restore API running inside the restore VM
+//! File-restore API running inside the restore VM
 use std::ffi::OsStr;
 use std::fs;
 use std::os::unix::ffi::OsStrExt;
diff --git a/proxmox-restore-daemon/src/proxmox_restore_daemon/mod.rs b/proxmox-restore-daemon/src/proxmox_restore_daemon/mod.rs
index 58e2bb6e1..d50c3287a 100644
--- a/proxmox-restore-daemon/src/proxmox_restore_daemon/mod.rs
+++ b/proxmox-restore-daemon/src/proxmox_restore_daemon/mod.rs
@@ -1,4 +1,4 @@
-///! File restore VM related functionality
+//! File restore VM related functionality
 mod api;
 pub use api::*;
 
-- 
2.39.5



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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [pbs-devel] [PATCH backup 10/13] remove redundant imports
  2024-12-02  9:57 [pbs-devel] [PATCH backup 01/13] remove needless borrows Maximiliano Sandoval
                   ` (7 preceding siblings ...)
  2024-12-02  9:58 ` [pbs-devel] [PATCH backup 09/13] docs: fix outer docs comments Maximiliano Sandoval
@ 2024-12-02  9:58 ` Maximiliano Sandoval
  2024-12-02  9:58 ` [pbs-devel] [PATCH backup 11/13] restore_daemon: use map_while instead of filter_map(Result::ok) Maximiliano Sandoval
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Maximiliano Sandoval @ 2024-12-02  9:58 UTC (permalink / raw)
  To: pbs-devel

Fixes the single_component_path_imports clippy lint:

```
warning: this import is redundant
  --> proxmox-file-restore/src/block_driver_qemu.rs:15:1
   |
15 | use proxmox_systemd;
   | ^^^^^^^^^^^^^^^^^^^^ help: remove it entirely
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_component_path_imports
   = note: `#[warn(clippy::single_component_path_imports)]` on by default

warning: this import is redundant
  --> proxmox-backup-client/src/mount.rs:19:1
   |
19 | use proxmox_systemd;
   | ^^^^^^^^^^^^^^^^^^^^ help: remove it entirely
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_component_path_imports
   = note: `#[warn(clippy::single_component_path_imports)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxmox-backup-client/src/mount.rs            | 1 -
 proxmox-file-restore/src/block_driver_qemu.rs | 1 -
 2 files changed, 2 deletions(-)

diff --git a/proxmox-backup-client/src/mount.rs b/proxmox-backup-client/src/mount.rs
index 4929f5e5d..a5fee8329 100644
--- a/proxmox-backup-client/src/mount.rs
+++ b/proxmox-backup-client/src/mount.rs
@@ -16,7 +16,6 @@ use tokio::signal::unix::{signal, SignalKind};
 use proxmox_router::{cli::*, ApiHandler, ApiMethod, RpcEnvironment};
 use proxmox_schema::*;
 use proxmox_sortable_macro::sortable;
-use proxmox_systemd;
 
 use pbs_api_types::{ArchiveType, BackupArchiveName, BackupNamespace};
 use pbs_client::tools::key_source::get_encryption_key_password;
diff --git a/proxmox-file-restore/src/block_driver_qemu.rs b/proxmox-file-restore/src/block_driver_qemu.rs
index adc6ccc7c..2e19d08ed 100644
--- a/proxmox-file-restore/src/block_driver_qemu.rs
+++ b/proxmox-file-restore/src/block_driver_qemu.rs
@@ -12,7 +12,6 @@ use serde::{Deserialize, Serialize};
 use serde_json::json;
 
 use proxmox_sys::fs::lock_file;
-use proxmox_systemd;
 
 use pbs_api_types::{file_restore::FileRestoreFormat, BackupDir, BackupNamespace};
 use pbs_client::{BackupRepository, VsockClient, DEFAULT_VSOCK_PORT};
-- 
2.39.5



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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [pbs-devel] [PATCH backup 11/13] restore_daemon: use map_while instead of filter_map(Result::ok)
  2024-12-02  9:57 [pbs-devel] [PATCH backup 01/13] remove needless borrows Maximiliano Sandoval
                   ` (8 preceding siblings ...)
  2024-12-02  9:58 ` [pbs-devel] [PATCH backup 10/13] remove redundant imports Maximiliano Sandoval
@ 2024-12-02  9:58 ` Maximiliano Sandoval
  2024-12-02  9:58 ` [pbs-devel] [PATCH backup 12/13] datastore: simplify let-else block with ? operator Maximiliano Sandoval
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Maximiliano Sandoval @ 2024-12-02  9:58 UTC (permalink / raw)
  To: pbs-devel

Fixes the lines_filter_map_ok clippy lint:

```
warning: `filter_map()` will run forever if the iterator repeatedly produces an `Err`
   --> proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs:195:14
    |
195 |             .filter_map(Result::ok)
    |              ^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `map_while(Result::ok)`
    |
note: this expression returning a `std::io::Lines` may produce an infinite number of `Err` in case of a read error
   --> proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs:193:18
    |
193 |           for f in BufReader::new(File::open("/proc/filesystems")?)
    |  __________________^
194 | |             .lines()
    | |____________________^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#lines_filter_map_ok
    = note: `#[warn(clippy::lines_filter_map_ok)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs b/proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs
index f60dbbfa2..50fbf315e 100644
--- a/proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs
+++ b/proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs
@@ -192,7 +192,7 @@ impl Filesystems {
         let mut supported_fs = Vec::new();
         for f in BufReader::new(File::open("/proc/filesystems")?)
             .lines()
-            .filter_map(Result::ok)
+            .map_while(Result::ok)
         {
             // ZFS is treated specially, don't attempt to do a regular mount with it
             let f = f.trim();
-- 
2.39.5



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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [pbs-devel] [PATCH backup 12/13] datastore: simplify let-else block with ? operator
  2024-12-02  9:57 [pbs-devel] [PATCH backup 01/13] remove needless borrows Maximiliano Sandoval
                   ` (9 preceding siblings ...)
  2024-12-02  9:58 ` [pbs-devel] [PATCH backup 11/13] restore_daemon: use map_while instead of filter_map(Result::ok) Maximiliano Sandoval
@ 2024-12-02  9:58 ` Maximiliano Sandoval
  2024-12-02  9:58 ` [pbs-devel] [PATCH backup 13/13] api: config: run rustfmt Maximiliano Sandoval
  2024-12-02 11:20 ` [pbs-devel] applied-series: [PATCH backup 01/13] remove needless borrows Fabian Grünbichler
  12 siblings, 0 replies; 14+ messages in thread
From: Maximiliano Sandoval @ 2024-12-02  9:58 UTC (permalink / raw)
  To: pbs-devel

Fixes the question_mark clippy lint:

```
warning: this `let...else` may be rewritten with the `?` operator
   --> pbs-datastore/src/datastore.rs:101:5
    |
101 | /     let Some(ref device_uuid) = config.backing_device else {
102 | |         return None;
103 | |     };
    | |______^ help: replace it with: `let ref device_uuid = config.backing_device?;`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark
    = note: `#[warn(clippy::question_mark)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 pbs-datastore/src/datastore.rs | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index 24d9eab2e..cf55befaa 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -98,9 +98,7 @@ fn is_datastore_mounted_at(store_mount_point: String, device_uuid: &str) -> bool
 }
 
 pub fn get_datastore_mount_status(config: &DataStoreConfig) -> Option<bool> {
-    let Some(ref device_uuid) = config.backing_device else {
-        return None;
-    };
+    let device_uuid = config.backing_device.as_ref()?;
     Some(is_datastore_mounted_at(config.absolute_path(), device_uuid))
 }
 
-- 
2.39.5



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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [pbs-devel] [PATCH backup 13/13] api: config: run rustfmt
  2024-12-02  9:57 [pbs-devel] [PATCH backup 01/13] remove needless borrows Maximiliano Sandoval
                   ` (10 preceding siblings ...)
  2024-12-02  9:58 ` [pbs-devel] [PATCH backup 12/13] datastore: simplify let-else block with ? operator Maximiliano Sandoval
@ 2024-12-02  9:58 ` Maximiliano Sandoval
  2024-12-02 11:20 ` [pbs-devel] applied-series: [PATCH backup 01/13] remove needless borrows Fabian Grünbichler
  12 siblings, 0 replies; 14+ messages in thread
From: Maximiliano Sandoval @ 2024-12-02  9:58 UTC (permalink / raw)
  To: pbs-devel

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 src/api2/config/datastore.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs
index 1dd9f82d9..df2681617 100644
--- a/src/api2/config/datastore.rs
+++ b/src/api2/config/datastore.rs
@@ -178,7 +178,11 @@ pub fn create_datastore(
     }
 
     if config.backing_device.is_none() && !config.path.starts_with("/") {
-        param_bail!("path", "expected an absolute path, '{}' is not", config.path);
+        param_bail!(
+            "path",
+            "expected an absolute path, '{}' is not",
+            config.path
+        );
     }
     if config.backing_device.is_some() && config.path.starts_with("/") {
         param_bail!(
-- 
2.39.5



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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [pbs-devel] applied-series: [PATCH backup 01/13] remove needless borrows
  2024-12-02  9:57 [pbs-devel] [PATCH backup 01/13] remove needless borrows Maximiliano Sandoval
                   ` (11 preceding siblings ...)
  2024-12-02  9:58 ` [pbs-devel] [PATCH backup 13/13] api: config: run rustfmt Maximiliano Sandoval
@ 2024-12-02 11:20 ` Fabian Grünbichler
  12 siblings, 0 replies; 14+ messages in thread
From: Fabian Grünbichler @ 2024-12-02 11:20 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion

the inspect_err code could be switched over to proper error context at
some point..

On December 2, 2024 10:57 am, Maximiliano Sandoval wrote:
> Fixes the needless_borrow lint.
> 
> Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
> ---
>  pbs-client/src/catalog_shell.rs      | 6 +++---
>  pbs-datastore/src/backup_info.rs     | 2 +-
>  pbs-datastore/src/datastore.rs       | 2 +-
>  proxmox-backup-client/src/catalog.rs | 4 ++--
>  proxmox-backup-client/src/main.rs    | 4 +---
>  src/api2/node/apt.rs                 | 2 +-
>  src/api2/node/disks/zfs.rs           | 2 +-
>  src/tools/disks/mod.rs               | 4 ++--
>  8 files changed, 12 insertions(+), 14 deletions(-)
> 
> diff --git a/pbs-client/src/catalog_shell.rs b/pbs-client/src/catalog_shell.rs
> index 7dace86bb..550daf56b 100644
> --- a/pbs-client/src/catalog_shell.rs
> +++ b/pbs-client/src/catalog_shell.rs
> @@ -529,7 +529,7 @@ impl Shell {
>                          None => bail!("no such file or directory: {entry:?}"),
>                      }
>                  } else {
> -                    let pxar_entry = parent_pxar_entry(&stack)?;
> +                    let pxar_entry = parent_pxar_entry(stack)?;
>                      let parent_dir = pxar_entry.enter_directory().await?;
>                      match parent_dir.lookup(entry).await? {
>                          Some(entry) => {
> @@ -575,7 +575,7 @@ impl Shell {
>                          None => bail!("no such file or directory: {:?}", entry),
>                      }
>                  } else {
> -                    let pxar_entry = parent_pxar_entry(&stack)?;
> +                    let pxar_entry = parent_pxar_entry(stack)?;
>                      let parent_dir = block_on(pxar_entry.enter_directory())?;
>                      match block_on(parent_dir.lookup(entry))? {
>                          Some(entry) => {
> @@ -766,7 +766,7 @@ impl Shell {
>                  let mut out = std::io::stdout();
>                  let items = crate::pxar::tools::pxar_metadata_read_dir(dir).await?;
>                  for item in items {
> -                    out.write_all(&item.file_name().as_bytes())?;
> +                    out.write_all(item.file_name().as_bytes())?;
>                      out.write_all(b"\n")?;
>                  }
>                  return Ok(());
> diff --git a/pbs-datastore/src/backup_info.rs b/pbs-datastore/src/backup_info.rs
> index be262773b..a92c47821 100644
> --- a/pbs-datastore/src/backup_info.rs
> +++ b/pbs-datastore/src/backup_info.rs
> @@ -428,7 +428,7 @@ impl BackupDir {
>  
>          std::fs::create_dir_all(&path)?;
>          let ts = self.backup_time_string();
> -        path.push(&format!("{ts}{MANIFEST_LOCK_NAME}"));
> +        path.push(format!("{ts}{MANIFEST_LOCK_NAME}"));
>  
>          Ok(path)
>      }
> diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
> index 4c062e244..24d9eab2e 100644
> --- a/pbs-datastore/src/datastore.rs
> +++ b/pbs-datastore/src/datastore.rs
> @@ -1151,7 +1151,7 @@ impl DataStore {
>              let _exclusive_lock = self.inner.chunk_store.try_exclusive_lock()?;
>  
>              let (config, _digest) = pbs_config::datastore::config()?;
> -            let gc_store_config: DataStoreConfig = config.lookup("datastore", &self.name())?;
> +            let gc_store_config: DataStoreConfig = config.lookup("datastore", self.name())?;
>              let all_stores = config.convert_to_typed_array("datastore")?;
>              if let Err(err) = gc_store_config.ensure_not_nested(&all_stores) {
>                  info!(
> diff --git a/proxmox-backup-client/src/catalog.rs b/proxmox-backup-client/src/catalog.rs
> index 0e20886a0..7173c8efc 100644
> --- a/proxmox-backup-client/src/catalog.rs
> +++ b/proxmox-backup-client/src/catalog.rs
> @@ -240,7 +240,7 @@ async fn catalog_shell(param: Value) -> Result<(), Error> {
>          )
>          .await?;
>  
> -        let state = Shell::new(None, &server_archive_name.as_ref(), accessor).await?;
> +        let state = Shell::new(None, server_archive_name.as_ref(), accessor).await?;
>          log::info!("Starting interactive shell");
>          state.shell().await?;
>          record_repository(&repo);
> @@ -283,7 +283,7 @@ async fn catalog_shell(param: Value) -> Result<(), Error> {
>  
>      catalogfile.seek(SeekFrom::Start(0))?;
>      let catalog_reader = CatalogReader::new(catalogfile);
> -    let state = Shell::new(Some(catalog_reader), &server_archive_name.as_ref(), decoder).await?;
> +    let state = Shell::new(Some(catalog_reader), server_archive_name.as_ref(), decoder).await?;
>  
>      log::info!("Starting interactive shell");
>      state.shell().await?;
> diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs
> index 89f91e2b5..580feb626 100644
> --- a/proxmox-backup-client/src/main.rs
> +++ b/proxmox-backup-client/src/main.rs
> @@ -1017,9 +1017,7 @@ async fn create_backup(
>              (BackupSpecificationType::PXAR, true) => {
>                  log_file("directory", &filename, target.as_ref())
>              }
> -            (BackupSpecificationType::IMAGE, true) => {
> -                log_file("image", &filename, &target.as_ref())
> -            }
> +            (BackupSpecificationType::IMAGE, true) => log_file("image", &filename, target.as_ref()),
>              // no dry-run
>              (BackupSpecificationType::CONFIG, false) => {
>                  let upload_options = UploadOptions {
> diff --git a/src/api2/node/apt.rs b/src/api2/node/apt.rs
> index 672ef7bf7..8be6ee261 100644
> --- a/src/api2/node/apt.rs
> +++ b/src/api2/node/apt.rs
> @@ -181,7 +181,7 @@ pub fn get_versions() -> Result<Vec<APTUpdateInfo>, Error> {
>          "proxmox-backup",
>          "proxmox-backup-server",
>          &running_daemon_version,
> -        &PACKAGES,
> +        PACKAGES,
>      )
>  }
>  
> diff --git a/src/api2/node/disks/zfs.rs b/src/api2/node/disks/zfs.rs
> index a31320c54..b6cf18265 100644
> --- a/src/api2/node/disks/zfs.rs
> +++ b/src/api2/node/disks/zfs.rs
> @@ -290,7 +290,7 @@ pub fn create_zpool(
>              let mut command = std::process::Command::new("zfs");
>              command.arg("set");
>              if let Some(compression) = compression {
> -                command.arg(&format!("compression={}", compression));
> +                command.arg(format!("compression={compression}"));
>              }
>              command.args(["relatime=on", &name]);
>              info!("# {command:?}");
> diff --git a/src/tools/disks/mod.rs b/src/tools/disks/mod.rs
> index 61aceccd6..571446db2 100644
> --- a/src/tools/disks/mod.rs
> +++ b/src/tools/disks/mod.rs
> @@ -1215,7 +1215,7 @@ pub fn change_parttype(part_disk: &Disk, part_type: &str) -> Result<(), Error> {
>          let minor = unsafe { libc::minor(stat.st_rdev) };
>          let partnum_path = &format!("/sys/dev/block/{}:{}/partition", major, minor);
>          let partnum: u32 = std::fs::read_to_string(partnum_path)?.trim_end().parse()?;
> -        sgdisk_command.arg(&format!("-t{}:{}", partnum, part_type));
> +        sgdisk_command.arg(format!("-t{}:{}", partnum, part_type));
>          let part_disk_parent = match part_disk.parent() {
>              Some(disk) => disk,
>              None => bail!("disk {:?} has no node in /dev", part_disk.syspath()),
> @@ -1355,7 +1355,7 @@ pub fn get_fs_uuid(disk: &Disk) -> Result<String, Error> {
>  /// Mount a disk by its UUID and the mount point.
>  pub fn mount_by_uuid(uuid: &str, mount_point: &Path) -> Result<(), Error> {
>      let mut command = std::process::Command::new("mount");
> -    command.arg(&format!("UUID={uuid}"));
> +    command.arg(format!("UUID={uuid}"));
>      command.arg(mount_point);
>  
>      proxmox_sys::command::run_command(command, None)?;
> -- 
> 2.39.5
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-12-02 11:20 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-02  9:57 [pbs-devel] [PATCH backup 01/13] remove needless borrows Maximiliano Sandoval
2024-12-02  9:57 ` [pbs-devel] [PATCH backup 02/13] use inspect_err when possible Maximiliano Sandoval
2024-12-02  9:57 ` [pbs-devel] [PATCH backup 03/13] backup_manager: use Vec::first instead of get(0) Maximiliano Sandoval
2024-12-02  9:57 ` [pbs-devel] [PATCH backup 04/13] push: use unwrap_or to prevent lazy evaluation Maximiliano Sandoval
2024-12-02  9:58 ` [pbs-devel] [PATCH backup 05/13] docs: use sublist indentation Maximiliano Sandoval
2024-12-02  9:58 ` [pbs-devel] [PATCH backup 06/13] client: remove unnecessary deref Maximiliano Sandoval
2024-12-02  9:58 ` [pbs-devel] [PATCH backup 07/13] remove needless type conversion Maximiliano Sandoval
2024-12-02  9:58 ` [pbs-devel] [PATCH backup 08/13] client: catalog: remove unnecessary sort_unstable_by Maximiliano Sandoval
2024-12-02  9:58 ` [pbs-devel] [PATCH backup 09/13] docs: fix outer docs comments Maximiliano Sandoval
2024-12-02  9:58 ` [pbs-devel] [PATCH backup 10/13] remove redundant imports Maximiliano Sandoval
2024-12-02  9:58 ` [pbs-devel] [PATCH backup 11/13] restore_daemon: use map_while instead of filter_map(Result::ok) Maximiliano Sandoval
2024-12-02  9:58 ` [pbs-devel] [PATCH backup 12/13] datastore: simplify let-else block with ? operator Maximiliano Sandoval
2024-12-02  9:58 ` [pbs-devel] [PATCH backup 13/13] api: config: run rustfmt Maximiliano Sandoval
2024-12-02 11:20 ` [pbs-devel] applied-series: [PATCH backup 01/13] remove needless borrows Fabian Grünbichler

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