[pbs-devel] [PATCH backup 03/13] remove needless borrows

Maximiliano Sandoval m.sandoval at proxmox.com
Mon Feb 12 14:17:28 CET 2024


Fixes the clippy lint:

```
warning: the borrowed expression implements the required traits
   --> src/server/report.rs:193:47
    |
193 |                         get_directory_content(&path)
    |                                               ^^^^^ help: change this to: `path`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
    = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
 src/server/pull.rs                    | 4 ++--
 src/server/report.rs                  | 2 +-
 src/tape/changer/online_status_map.rs | 2 +-
 src/tools/disks/mod.rs                | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/server/pull.rs b/src/server/pull.rs
index 5f235b0a..5a4ba806 100644
--- a/src/server/pull.rs
+++ b/src/server/pull.rs
@@ -199,7 +199,7 @@ impl PullSource for RemoteSource {
         });
 
         if !namespace.is_root() {
-            args["ns"] = serde_json::to_value(&namespace)?;
+            args["ns"] = serde_json::to_value(namespace)?;
         }
 
         self.client.login().await?;
@@ -230,7 +230,7 @@ impl PullSource for RemoteSource {
     }
 
     fn get_store(&self) -> &str {
-        &self.repo.store()
+        self.repo.store()
     }
 
     async fn reader(
diff --git a/src/server/report.rs b/src/server/report.rs
index 6b033832..d97efb14 100644
--- a/src/server/report.rs
+++ b/src/server/report.rs
@@ -190,7 +190,7 @@ pub fn generate_report() -> String {
                 .map(|file_name| {
                     let path = Path::new(file_name);
                     if path.is_dir() {
-                        get_directory_content(&path)
+                        get_directory_content(path)
                     } else {
                         get_file_content(file_name)
                     }
diff --git a/src/tape/changer/online_status_map.rs b/src/tape/changer/online_status_map.rs
index c3da0415..d7f3ca7a 100644
--- a/src/tape/changer/online_status_map.rs
+++ b/src/tape/changer/online_status_map.rs
@@ -88,7 +88,7 @@ impl OnlineStatusMap {
 }
 
 fn insert_into_online_set(inventory: &Inventory, label_text: &str, online_set: &mut HashSet<Uuid>) {
-    match inventory.find_media_by_label_text(&label_text) {
+    match inventory.find_media_by_label_text(label_text) {
         Ok(Some(media_id)) => {
             online_set.insert(media_id.label.uuid.clone());
         }
diff --git a/src/tools/disks/mod.rs b/src/tools/disks/mod.rs
index 7a772356..78360b66 100644
--- a/src/tools/disks/mod.rs
+++ b/src/tools/disks/mod.rs
@@ -1167,7 +1167,7 @@ pub fn wipe_blockdev(disk: &Disk, worker: Arc<WorkerTask>) -> Result<(), Error>
 
     if is_partition {
         // set the partition type to 0x83 'Linux filesystem'
-        change_parttype(&disk, "8300", worker)?;
+        change_parttype(disk, "8300", worker)?;
     }
 
     Ok(())
-- 
2.39.2





More information about the pbs-devel mailing list