[pdm-devel] [PATCH proxmox-datacenter-manager] clippy: don't `Clone::clone` CreateOptions, use `Copy`

Lukas Wagner l.wagner at proxmox.com
Fri Apr 11 14:05:27 CEST 2025


proxmox-sys 0.6.6 now derives Copy for CreateOptions, we should use it
to silence some clippy warnings.

Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
---
 Cargo.toml                                          |  2 +-
 debian/control                                      |  8 ++++----
 lib/pdm-config/src/config_version_cache.rs          |  2 +-
 server/src/auth/tfa.rs                              |  7 ++++---
 server/src/bin/proxmox-datacenter-api/main.rs       | 13 +++++--------
 .../bin/proxmox-datacenter-manager-daily-update.rs  |  5 +----
 server/src/bin/proxmox-datacenter-privileged-api.rs | 13 +++++--------
 7 files changed, 21 insertions(+), 29 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index f66254d6..6e16831e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -55,7 +55,7 @@ proxmox-shared-memory = "0.3.0"
 proxmox-simple-config = "0.1"
 proxmox-sortable-macro = "0.1.2"
 proxmox-subscription = { version = "0.5", features = [ "api-types"], default-features = false }
-proxmox-sys = "0.6.0"
+proxmox-sys = "0.6.6"
 proxmox-systemd = "0.1"
 proxmox-tfa = { version = "5", features = [ "api-types" ], default-features = false }
 proxmox-time = "2"
diff --git a/debian/control b/debian/control
index 3e0b18ba..8241c405 100644
--- a/debian/control
+++ b/debian/control
@@ -74,10 +74,10 @@ Build-Depends: cargo:native,
                librust-proxmox-sortable-macro-0.1+default-dev (>= 0.1.2-~~),
                librust-proxmox-subscription-0.5+api-types-dev,
                librust-proxmox-subscription-0.5+impl-dev,
-               librust-proxmox-sys-0.6+acl-dev,
-               librust-proxmox-sys-0.6+crypt-dev,
-               librust-proxmox-sys-0.6+default-dev,
-               librust-proxmox-sys-0.6+timer-dev,
+               librust-proxmox-sys-0.6+acl-dev (>= 0.6.6-~~),
+               librust-proxmox-sys-0.6+crypt-dev (>= 0.6.6-~~),
+               librust-proxmox-sys-0.6+default-dev (>= 0.6.6-~~),
+               librust-proxmox-sys-0.6+timer-dev (>= 0.6.6-~~),
                librust-proxmox-syslog-api-0.1+default-dev,
                librust-proxmox-syslog-api-0.1+impl-dev,
                librust-proxmox-systemd-0.1+default-dev,
diff --git a/lib/pdm-config/src/config_version_cache.rs b/lib/pdm-config/src/config_version_cache.rs
index 5c4b61a0..36a6a778 100644
--- a/lib/pdm-config/src/config_version_cache.rs
+++ b/lib/pdm-config/src/config_version_cache.rs
@@ -112,7 +112,7 @@ impl ConfigVersionCache {
         let file_path = Path::new(FILE_PATH);
         let dir_path = file_path.parent().unwrap();
 
-        create_path(dir_path, Some(dir_opts.clone()), Some(dir_opts))?;
+        create_path(dir_path, Some(dir_opts), Some(dir_opts))?;
 
         let file_opts = CreateOptions::new()
             .perm(Mode::from_bits_truncate(0o660))
diff --git a/server/src/auth/tfa.rs b/server/src/auth/tfa.rs
index fe7cd52a..66d3c1d3 100644
--- a/server/src/auth/tfa.rs
+++ b/server/src/auth/tfa.rs
@@ -208,14 +208,15 @@ impl proxmox_tfa::api::OpenUserChallengeData for UserAccess {
     /// if it does not exist), and keep a lock on the file.
     fn open(&self, userid: &str) -> Result<Box<dyn UserChallengeAccess>, Error> {
         let options = CreateOptions::new().perm(Mode::from_bits_truncate(0o0600));
-        proxmox_sys::fs::create_path(CHALLENGE_DATA_PATH, Some(options.clone()), Some(options))
-            .map_err(|err| {
+        proxmox_sys::fs::create_path(CHALLENGE_DATA_PATH, Some(options), Some(options)).map_err(
+            |err| {
                 format_err!(
                     "failed to crate challenge data dir {:?}: {}",
                     CHALLENGE_DATA_PATH,
                     err
                 )
-            })?;
+            },
+        )?;
 
         let path = challenge_data_path_str(userid);
 
diff --git a/server/src/bin/proxmox-datacenter-api/main.rs b/server/src/bin/proxmox-datacenter-api/main.rs
index 25852c8c..ad1dc66d 100644
--- a/server/src/bin/proxmox-datacenter-api/main.rs
+++ b/server/src/bin/proxmox-datacenter-api/main.rs
@@ -174,23 +174,20 @@ async fn run(debug: bool) -> Result<(), Error> {
         //.register_template("console", "/usr/share/pve-xtermjs/index.html.hbs")?
         .enable_access_log(
             pdm_buildcfg::API_ACCESS_LOG_FN,
-            Some(dir_opts.clone()),
-            Some(file_opts.clone()),
+            Some(dir_opts),
+            Some(file_opts),
             &mut command_sock,
         )?
         .enable_auth_log(
             pdm_buildcfg::API_AUTH_LOG_FN,
-            Some(dir_opts.clone()),
-            Some(file_opts.clone()),
+            Some(dir_opts),
+            Some(file_opts),
             &mut command_sock,
         )?;
 
     let rest_server = RestServer::new(config);
     let redirector = proxmox_rest_server::Redirector::new();
-    proxmox_rest_server::init_worker_tasks(
-        pdm_buildcfg::PDM_LOG_DIR_M!().into(),
-        file_opts.clone(),
-    )?;
+    proxmox_rest_server::init_worker_tasks(pdm_buildcfg::PDM_LOG_DIR_M!().into(), file_opts)?;
 
     //openssl req -x509 -newkey rsa:4096 -keyout /etc/proxmox-backup/api.key -out /etc/proxmox-backup/api.pem -nodes
 
diff --git a/server/src/bin/proxmox-datacenter-manager-daily-update.rs b/server/src/bin/proxmox-datacenter-manager-daily-update.rs
index 883f7ac4..43ad5383 100644
--- a/server/src/bin/proxmox-datacenter-manager-daily-update.rs
+++ b/server/src/bin/proxmox-datacenter-manager-daily-update.rs
@@ -94,10 +94,7 @@ async fn check_acme_certificates(rpcenv: &mut dyn RpcEnvironment) -> Result<(),
 async fn run(rpcenv: &mut dyn RpcEnvironment) -> Result<(), Error> {
     let api_user = pdm_config::api_user()?;
     let file_opts = CreateOptions::new().owner(api_user.uid).group(api_user.gid);
-    proxmox_rest_server::init_worker_tasks(
-        pdm_buildcfg::PDM_LOG_DIR_M!().into(),
-        file_opts.clone(),
-    )?;
+    proxmox_rest_server::init_worker_tasks(pdm_buildcfg::PDM_LOG_DIR_M!().into(), file_opts)?;
 
     let mut command_sock = proxmox_daemon::command_socket::CommandSocket::new(api_user.gid);
     proxmox_rest_server::register_task_control_commands(&mut command_sock)?;
diff --git a/server/src/bin/proxmox-datacenter-privileged-api.rs b/server/src/bin/proxmox-datacenter-privileged-api.rs
index 0e23a5f1..a9b5c5e8 100644
--- a/server/src/bin/proxmox-datacenter-privileged-api.rs
+++ b/server/src/bin/proxmox-datacenter-privileged-api.rs
@@ -126,22 +126,19 @@ async fn run() -> Result<(), Error> {
         .formatted_router(&["api2"], &server::api::ROUTER)
         .enable_access_log(
             pdm_buildcfg::API_ACCESS_LOG_FN,
-            Some(dir_opts.clone()),
-            Some(file_opts.clone()),
+            Some(dir_opts),
+            Some(file_opts),
             &mut command_sock,
         )?
         .enable_auth_log(
             pdm_buildcfg::API_AUTH_LOG_FN,
-            Some(dir_opts.clone()),
-            Some(file_opts.clone()),
+            Some(dir_opts),
+            Some(file_opts),
             &mut command_sock,
         )?;
 
     let rest_server = RestServer::new(config);
-    proxmox_rest_server::init_worker_tasks(
-        pdm_buildcfg::PDM_LOG_DIR_M!().into(),
-        file_opts.clone(),
-    )?;
+    proxmox_rest_server::init_worker_tasks(pdm_buildcfg::PDM_LOG_DIR_M!().into(), file_opts)?;
 
     let server = proxmox_daemon::server::create_daemon(
         std::os::unix::net::SocketAddr::from_pathname(pdm_buildcfg::PDM_PRIVILEGED_API_SOCKET_FN)
-- 
2.39.5





More information about the pdm-devel mailing list