From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 9A9B21FF173 for ; Mon, 13 Jan 2025 13:08:52 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7EB752DA5E; Mon, 13 Jan 2025 13:08:35 +0100 (CET) From: Maximiliano Sandoval To: pdm-devel@lists.proxmox.com Date: Mon, 13 Jan 2025 13:08:29 +0100 Message-Id: <20250113120831.299244-2-m.sandoval@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250113120831.299244-1-m.sandoval@proxmox.com> References: <20250113120831.299244-1-m.sandoval@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.055 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 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_SBL_A 0.1 Contains URL's A record listed in the Spamhaus SBL blocklist [185.199.110.153, 185.199.111.153, 185.199.108.153, 185.199.109.153] Subject: [pdm-devel] [PATCH proxmox-datacenter-manager 2/4] remove needless borrows X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" 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 --- 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, 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