From: Filip Schauer <f.schauer@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox 1/2] rest-server: simplify path concatenation
Date: Tue, 7 Oct 2025 12:17:47 +0200 [thread overview]
Message-ID: <20251007101757.82742-2-f.schauer@proxmox.com> (raw)
In-Reply-To: <20251007101757.82742-1-f.schauer@proxmox.com>
Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
---
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
next prev parent reply other threads:[~2025-10-07 10:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-07 10:17 [pbs-devel] [PATCH proxmox 0/2] rest-server: minor code cleanup Filip Schauer
2025-10-07 10:17 ` Filip Schauer [this message]
2025-10-07 10:17 ` [pbs-devel] [PATCH proxmox 2/2] rest-server: use variables directly in format strings Filip Schauer
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=20251007101757.82742-2-f.schauer@proxmox.com \
--to=f.schauer@proxmox.com \
--cc=pbs-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