From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 580731FF191 for ; Tue, 7 Oct 2025 12:19:15 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C1946153B8; Tue, 7 Oct 2025 12:19:19 +0200 (CEST) From: Filip Schauer To: pbs-devel@lists.proxmox.com Date: Tue, 7 Oct 2025 12:17:47 +0200 Message-ID: <20251007101757.82742-2-f.schauer@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251007101757.82742-1-f.schauer@proxmox.com> References: <20251007101757.82742-1-f.schauer@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1759832297748 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.007 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 Subject: [pbs-devel] [PATCH proxmox 1/2] rest-server: simplify path concatenation X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Signed-off-by: Filip Schauer --- proxmox-rest-server/src/worker_task.rs | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/proxmox-rest-server/src/worker_task.rs b/proxmox-rest-server/src/worker_task.rs index c9ae5243..1f9578c8 100644 --- a/proxmox-rest-server/src/worker_task.rs +++ b/proxmox-rest-server/src/worker_task.rs @@ -110,17 +110,10 @@ impl WorkerTaskSetup { let mut taskdir = basedir; taskdir.push("tasks"); - let mut task_lock_fn = taskdir.clone(); - task_lock_fn.push(".active.lock"); - - let mut active_tasks_fn = taskdir.clone(); - active_tasks_fn.push("active"); - - let mut task_index_fn = taskdir.clone(); - task_index_fn.push("index"); - - let mut task_archive_fn = taskdir.clone(); - task_archive_fn.push("archive"); + let task_lock_fn = taskdir.join(".active.lock"); + let active_tasks_fn = taskdir.join("active"); + let task_index_fn = taskdir.join("index"); + let task_archive_fn = taskdir.join("archive"); Self { file_opts, @@ -146,9 +139,7 @@ impl WorkerTaskSetup { } fn log_directory(&self, upid: &UPID) -> std::path::PathBuf { - let mut path = self.taskdir.clone(); - path.push(format!("{:02X}", upid.pstart & 255)); - path + self.taskdir.join(format!("{:02X}", upid.pstart & 255)) } fn log_path(&self, upid: &UPID) -> std::path::PathBuf { @@ -381,8 +372,7 @@ pub fn cleanup_old_tasks(compressed: bool) -> Result<(), Error> { .ok_or_else(|| format_err!("could not calculate cutoff time"))?; for i in 0..256 { - let mut path = setup.taskdir.clone(); - path.push(format!("{:02X}", i)); + let path = setup.taskdir.join(format!("{i:02X}")); let files = match std::fs::read_dir(path) { Ok(files) => files, Err(err) if err.kind() == std::io::ErrorKind::NotFound => continue, -- 2.47.3 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel