public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox-datacenter-manager 2/4] remove needless borrows
Date: Mon, 13 Jan 2025 13:08:29 +0100	[thread overview]
Message-ID: <20250113120831.299244-2-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20250113120831.299244-1-m.sandoval@proxmox.com>

Fixes e.g.

warning: this expression creates a reference which is immediately dereferenced by the compiler
  --> server/src/task_cache.rs:45:37
   |
45 |             let tasks = fetch_tasks(&remote).await?;
   |                                     ^^^^^^^ help: change this to: `remote`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
   = note: `#[warn(clippy::needless_borrow)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 server/src/api/resources.rs         | 6 +++---
 server/src/metric_collection/mod.rs | 2 +-
 server/src/task_cache.rs            | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
index 376d493..f6438c6 100644
--- a/server/src/api/resources.rs
+++ b/server/src/api/resources.rs
@@ -106,7 +106,7 @@ pub(crate) async fn get_resources_impl(
 
     for (remote_name, remote) in remotes_config {
         if let Some(ref auth_id) = opt_auth_id {
-            let remote_privs = user_info.lookup_privs(&auth_id, &["resource", &remote_name]);
+            let remote_privs = user_info.lookup_privs(auth_id, &["resource", &remote_name]);
             if remote_privs & PRIV_RESOURCE_AUDIT == 0 {
                 continue;
             }
@@ -441,7 +441,7 @@ async fn fetch_remote_subscription_info(
     let mut list = HashMap::new();
     match remote.ty {
         RemoteType::Pve => {
-            let client = connection::make_pve_client(&remote)?;
+            let client = connection::make_pve_client(remote)?;
 
             let nodes = client.list_nodes().await?;
             let mut futures = Vec::with_capacity(nodes.len());
@@ -471,7 +471,7 @@ async fn fetch_remote_subscription_info(
             }
         }
         RemoteType::Pbs => {
-            let client = connection::make_pbs_client(&remote)?;
+            let client = connection::make_pbs_client(remote)?;
 
             let info = client.get_subscription().await.ok().map(|info| {
                 let level = SubscriptionLevel::from_key(info.key.as_deref());
diff --git a/server/src/metric_collection/mod.rs b/server/src/metric_collection/mod.rs
index c887e1f..b37d678 100644
--- a/server/src/metric_collection/mod.rs
+++ b/server/src/metric_collection/mod.rs
@@ -76,7 +76,7 @@ async fn metric_collection_task() -> Result<(), Error> {
                         .await
                     }
                     RemoteType::Pbs => {
-                        let client = connection::make_pbs_client(&remote)?;
+                        let client = connection::make_pbs_client(remote)?;
                         let metrics = client.metrics(Some(true), Some(start_time)).await?;
 
                         // Involves some blocking file IO
diff --git a/server/src/task_cache.rs b/server/src/task_cache.rs
index dab29fe..2d3c9b6 100644
--- a/server/src/task_cache.rs
+++ b/server/src/task_cache.rs
@@ -42,7 +42,7 @@ pub async fn get_tasks(max_age: i64) -> Result<Vec<TaskListItem>, Error> {
             // Data in cache is recent enough and has not been invalidated.
             all_tasks.extend(tasks);
         } else {
-            let tasks = fetch_tasks(&remote).await?;
+            let tasks = fetch_tasks(remote).await?;
             cache.set_tasks(remote_name.as_str(), tasks.clone(), now);
 
             all_tasks.extend(tasks);
-- 
2.39.5



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


  reply	other threads:[~2025-01-13 12:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13 12:08 [pdm-devel] [PATCH proxmox-datacenter-manager 1/4] elide lifetimes in traits when possible Maximiliano Sandoval
2025-01-13 12:08 ` Maximiliano Sandoval [this message]
2025-01-13 12:08 ` [pdm-devel] [PATCH proxmox-datacenter-manager 3/4] task_cache: Do field assigment inside initializer Maximiliano Sandoval
2025-01-13 12:08 ` [pdm-devel] [PATCH proxmox-datacenter-manager 4/4] resources: Remove unnecessary closure Maximiliano Sandoval
2025-01-13 12:15 ` [pdm-devel] applied: [PATCH proxmox-datacenter-manager 1/4] elide lifetimes in traits when possible Dietmar Maurer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250113120831.299244-2-m.sandoval@proxmox.com \
    --to=m.sandoval@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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