From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pbs-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 0BB271FF16B for <inbox@lore.proxmox.com>; Thu, 20 Mar 2025 14:50:05 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id AB569394C; Thu, 20 Mar 2025 14:50:04 +0100 (CET) Date: Thu, 20 Mar 2025 14:49:30 +0100 From: Wolfgang Bumiller <w.bumiller@proxmox.com> To: Christian Ebner <c.ebner@proxmox.com> Message-ID: <f5h3nsbaidxxl5ljp2siaskr4otgir347i3qiatng5nonh55kz@evjf77zzcni3> References: <20250320133827.342699-1-c.ebner@proxmox.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20250320133827.342699-1-c.ebner@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL -0.069 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 POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_2 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_4 0.1 random spam to be learned in bayes 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] applied: [PATCH proxmox-backup] clippy/fmt: tree wide drop of clone for types implementing copy X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion <pbs-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/> List-Post: <mailto:pbs-devel@lists.proxmox.com> List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox Backup Server development discussion <pbs-devel@lists.proxmox.com> Cc: pbs-devel@lists.proxmox.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" <pbs-devel-bounces@lists.proxmox.com> applied, thanks On Thu, Mar 20, 2025 at 02:38:27PM +0100, Christian Ebner wrote: > fixes the clippy warning on types T implementing Copy: > ``` > warning: using `clone` on type `T` which implements the `Copy` trait > ``` > > followed by formatting fixups via `cargo fmt`. > > Signed-off-by: Christian Ebner <c.ebner@proxmox.com> > --- > pbs-config/src/config_version_cache.rs | 2 +- > pbs-datastore/src/chunk_store.rs | 8 ++++---- > pbs-datastore/src/task_tracking.rs | 2 +- > src/api2/admin/datastore.rs | 20 ++++++-------------- > src/bin/proxmox-backup-api.rs | 10 +++++----- > src/bin/proxmox-backup-proxy.rs | 14 +++++++------- > src/bin/proxmox-daily-update.rs | 2 +- > src/bin/proxmox_backup_debug/inspect.rs | 4 ++-- > src/config/tfa.rs | 7 ++++--- > src/server/jobstate.rs | 2 +- > src/tools/shared_rate_limiter.rs | 2 +- > 11 files changed, 33 insertions(+), 40 deletions(-) > > diff --git a/pbs-config/src/config_version_cache.rs b/pbs-config/src/config_version_cache.rs > index 3d570e937..e8fb994fb 100644 > --- a/pbs-config/src/config_version_cache.rs > +++ b/pbs-config/src/config_version_cache.rs > @@ -101,7 +101,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/pbs-datastore/src/chunk_store.rs b/pbs-datastore/src/chunk_store.rs > index 5e02909a1..dc267d752 100644 > --- a/pbs-datastore/src/chunk_store.rs > +++ b/pbs-datastore/src/chunk_store.rs > @@ -109,7 +109,7 @@ impl ChunkStore { > > let default_options = CreateOptions::new(); > > - match create_path(&base, Some(default_options), Some(options.clone())) { > + match create_path(&base, Some(default_options), Some(options)) { > Err(err) => bail!("unable to create chunk store '{name}' at {base:?} - {err}"), > Ok(res) => { > if !res { > @@ -118,13 +118,13 @@ impl ChunkStore { > } > } > > - if let Err(err) = create_dir(&chunk_dir, options.clone()) { > + if let Err(err) = create_dir(&chunk_dir, options) { > bail!("unable to create chunk store '{name}' subdir {chunk_dir:?} - {err}"); > } > > // create lock file with correct owner/group > let lockfile_path = Self::lockfile_path(&base); > - proxmox_sys::fs::replace_file(lockfile_path, b"", options.clone(), false)?; > + proxmox_sys::fs::replace_file(lockfile_path, b"", options, false)?; > > // create 64*1024 subdirs > let mut last_percentage = 0; > @@ -132,7 +132,7 @@ impl ChunkStore { > for i in 0..64 * 1024 { > let mut l1path = chunk_dir.clone(); > l1path.push(format!("{:04x}", i)); > - if let Err(err) = create_dir(&l1path, options.clone()) { > + if let Err(err) = create_dir(&l1path, options) { > bail!( > "unable to create chunk store '{}' subdir {:?} - {}", > name, > diff --git a/pbs-datastore/src/task_tracking.rs b/pbs-datastore/src/task_tracking.rs > index ec06a0bcc..77851cab6 100644 > --- a/pbs-datastore/src/task_tracking.rs > +++ b/pbs-datastore/src/task_tracking.rs > @@ -47,7 +47,7 @@ fn open_lock_file(name: &str) -> Result<(std::fs::File, CreateOptions), Error> { > let timeout = std::time::Duration::new(10, 0); > > Ok(( > - open_file_locked(lock_path, timeout, true, options.clone())?, > + open_file_locked(lock_path, timeout, true, options)?, > options, > )) > } > diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs > index cfe319c4e..483e595c1 100644 > --- a/src/api2/admin/datastore.rs > +++ b/src/api2/admin/datastore.rs > @@ -2416,20 +2416,12 @@ fn setup_mounted_device(datastore: &DataStoreConfig, tmp_mount_path: &str) -> Re > .owner(backup_user.uid) > .group(backup_user.gid); > > - proxmox_sys::fs::create_path( > - &mount_point, > - Some(default_options.clone()), > - Some(options.clone()), > - ) > - .map_err(|e| format_err!("creating mountpoint '{mount_point}' failed: {e}"))?; > + proxmox_sys::fs::create_path(&mount_point, Some(default_options), Some(options)) > + .map_err(|e| format_err!("creating mountpoint '{mount_point}' failed: {e}"))?; > > // can't be created before it is mounted, so we have to do it here > - proxmox_sys::fs::create_path( > - &full_store_path, > - Some(default_options.clone()), > - Some(options.clone()), > - ) > - .map_err(|e| format_err!("creating datastore path '{full_store_path}' failed: {e}"))?; > + proxmox_sys::fs::create_path(&full_store_path, Some(default_options), Some(options)) > + .map_err(|e| format_err!("creating datastore path '{full_store_path}' failed: {e}"))?; > > info!( > "bind mount '{}'({}) to '{}'", > @@ -2468,8 +2460,8 @@ pub fn do_mount_device(datastore: DataStoreConfig) -> Result<(), Error> { > let default_options = proxmox_sys::fs::CreateOptions::new(); > proxmox_sys::fs::create_path( > &tmp_mount_path, > - Some(default_options.clone()), > - Some(default_options.clone()), > + Some(default_options), > + Some(default_options), > )?; > > info!("temporarily mounting '{uuid}' to '{}'", tmp_mount_path); > diff --git a/src/bin/proxmox-backup-api.rs b/src/bin/proxmox-backup-api.rs > index 60f9b4948..7b4187550 100644 > --- a/src/bin/proxmox-backup-api.rs > +++ b/src/bin/proxmox-backup-api.rs > @@ -88,21 +88,21 @@ async fn run() -> Result<(), Error> { > .default_api2_handler(&proxmox_backup::api2::ROUTER) > .enable_access_log( > pbs_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( > pbs_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( > pbs_buildcfg::PROXMOX_BACKUP_LOG_DIR_M!().into(), > - file_opts.clone(), > + file_opts, > )?; > > // http server future: > diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs > index fdfa7463a..c9a6032e6 100644 > --- a/src/bin/proxmox-backup-proxy.rs > +++ b/src/bin/proxmox-backup-proxy.rs > @@ -223,14 +223,14 @@ async fn run() -> Result<(), Error> { > config = config > .enable_access_log( > pbs_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( > pbs_buildcfg::API_AUTH_LOG_FN, > - Some(dir_opts.clone()), > - Some(file_opts.clone()), > + Some(dir_opts), > + Some(file_opts), > &mut command_sock, > )?; > > @@ -238,7 +238,7 @@ async fn run() -> Result<(), Error> { > let redirector = Redirector::new(); > proxmox_rest_server::init_worker_tasks( > pbs_buildcfg::PROXMOX_BACKUP_LOG_DIR_M!().into(), > - file_opts.clone(), > + file_opts, > )?; > > //openssl req -x509 -newkey rsa:4096 -keyout /etc/proxmox-backup/proxy.key -out /etc/proxmox-backup/proxy.pem -nodes > @@ -752,7 +752,7 @@ async fn schedule_task_log_rotate() { > true, > Some(max_files), > max_days, > - Some(options.clone()), > + Some(options), > )?; > > if has_rotated { > @@ -768,7 +768,7 @@ async fn schedule_task_log_rotate() { > pbs_buildcfg::API_ACCESS_LOG_FN, > true, > Some(max_files), > - Some(options.clone()), > + Some(options), > )?; > > if logrotate.rotate(max_size)? { > diff --git a/src/bin/proxmox-daily-update.rs b/src/bin/proxmox-daily-update.rs > index 97ccd973f..224103ccb 100644 > --- a/src/bin/proxmox-daily-update.rs > +++ b/src/bin/proxmox-daily-update.rs > @@ -95,7 +95,7 @@ async fn run(rpcenv: &mut dyn RpcEnvironment) -> Result<(), Error> { > .group(backup_user.gid); > proxmox_rest_server::init_worker_tasks( > pbs_buildcfg::PROXMOX_BACKUP_LOG_DIR_M!().into(), > - file_opts.clone(), > + file_opts, > )?; > > let mut command_sock = proxmox_daemon::command_socket::CommandSocket::new(backup_user.gid); > diff --git a/src/bin/proxmox_backup_debug/inspect.rs b/src/bin/proxmox_backup_debug/inspect.rs > index 75a36870a..321080be3 100644 > --- a/src/bin/proxmox_backup_debug/inspect.rs > +++ b/src/bin/proxmox_backup_debug/inspect.rs > @@ -409,8 +409,8 @@ fn inspect_device(device: String, param: Value) -> Result<(), Error> { > let default_options = proxmox_sys::fs::CreateOptions::new(); > proxmox_sys::fs::create_path( > &tmp_mount_path, > - Some(default_options.clone()), > - Some(default_options.clone()), > + Some(default_options), > + Some(default_options), > )?; > let mut mount_cmd = std::process::Command::new("mount"); > mount_cmd.arg(device.clone()); > diff --git a/src/config/tfa.rs b/src/config/tfa.rs > index d89b53db9..2a55213bb 100644 > --- a/src/config/tfa.rs > +++ b/src/config/tfa.rs > @@ -199,14 +199,15 @@ impl proxmox_tfa::api::OpenUserChallengeData for UserAccess { > fn open(&self, userid: &str) -> Result<Box<dyn UserChallengeAccess>, Error> { > crate::server::create_run_dir()?; > 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/src/server/jobstate.rs b/src/server/jobstate.rs > index be9dac427..dc9f6c90d 100644 > --- a/src/server/jobstate.rs > +++ b/src/server/jobstate.rs > @@ -87,7 +87,7 @@ pub fn create_jobstate_dir() -> Result<(), Error> { > .owner(backup_user.uid) > .group(backup_user.gid); > > - create_path(JOB_STATE_BASEDIR, Some(opts.clone()), Some(opts)) > + create_path(JOB_STATE_BASEDIR, Some(opts), Some(opts)) > .map_err(|err: Error| format_err!("unable to create job state dir - {err}"))?; > > Ok(()) > diff --git a/src/tools/shared_rate_limiter.rs b/src/tools/shared_rate_limiter.rs > index 8c9e6086a..db754728b 100644 > --- a/src/tools/shared_rate_limiter.rs > +++ b/src/tools/shared_rate_limiter.rs > @@ -80,7 +80,7 @@ impl SharedRateLimiter { > .owner(user.uid) > .group(user.gid); > > - create_path(&path, Some(dir_opts.clone()), Some(dir_opts))?; > + create_path(&path, Some(dir_opts), Some(dir_opts))?; > > path.push(name); > > -- > 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel