diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.rs index 30dc192fb..8b7b5b731 100644 --- a/pbs-client/src/pxar/create.rs +++ b/pbs-client/src/pxar/create.rs @@ -1835,7 +1835,7 @@ mod tests { }; extractor.enter_directory( - OsString::from(format!("testdir")), + OsString::from("testdir".to_string()), dir_metadata.clone(), true, )?; diff --git a/pbs-config/src/network/mod.rs b/pbs-config/src/network/mod.rs index 19a2df8cb..14a2c6c35 100644 --- a/pbs-config/src/network/mod.rs +++ b/pbs-config/src/network/mod.rs @@ -571,11 +571,9 @@ mod tests { }; assert_eq!( String::try_from(nw_config).unwrap().trim(), - format!( - r#" + r#" iface enp3s0 inet static - address 10.0.0.100/16"# - ) + address 10.0.0.100/16"#.to_string() .trim() ); } @@ -596,12 +594,10 @@ iface enp3s0 inet static }; assert_eq!( String::try_from(nw_config).unwrap().trim(), - format!( - r#" + r#" iface enp3s0 inet static address 10.0.0.100/16 - gateway 10.0.0.1"# - ) + gateway 10.0.0.1"#.to_string() .trim() ); } diff --git a/pbs-tape/src/sg_pt_changer.rs b/pbs-tape/src/sg_pt_changer.rs index 3945d18f3..f3387756c 100644 --- a/pbs-tape/src/sg_pt_changer.rs +++ b/pbs-tape/src/sg_pt_changer.rs @@ -412,9 +412,9 @@ pub fn read_element_status(file: &mut F) -> Result for drive in drives.iter_mut() { for drive2 in &page.drives { if drive2.element_address == drive.element_address { - drive.vendor = drive2.vendor.clone(); - drive.model = drive2.model.clone(); - drive.drive_serial_number = drive2.drive_serial_number.clone(); + drive.vendor.clone_from(&drive2.vendor); + drive.model.clone_from(&drive2.model); + drive.drive_serial_number.clone_from(&drive2.drive_serial_number); } } } diff --git a/proxmox-backup-client/src/helper.rs b/proxmox-backup-client/src/helper.rs index d9d9837aa..60355d7d0 100644 --- a/proxmox-backup-client/src/helper.rs +++ b/proxmox-backup-client/src/helper.rs @@ -14,7 +14,7 @@ pub(crate) async fn get_pxar_fuse_accessor( crypt_config: Option>, ) -> Result { let (archive_name, payload_archive_name) = - pbs_client::tools::get_pxar_archive_names(archive_name, &manifest)?; + pbs_client::tools::get_pxar_archive_names(archive_name, manifest)?; let (reader, archive_size) = get_pxar_fuse_reader( &archive_name, diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs index 5f694b11e..ecd7b9e9f 100644 --- a/proxmox-backup-client/src/main.rs +++ b/proxmox-backup-client/src/main.rs @@ -256,7 +256,7 @@ async fn backup_directory>( }); let payload_stats = client.upload_stream( - &payload_target, + payload_target, stream, upload_options, Some(payload_injections_rx), @@ -1641,7 +1641,7 @@ async fn restore( let prelude_path = param["prelude-target"] .as_str() - .map(|path| PathBuf::from(path)); + .map(PathBuf::from); let options = pbs_client::pxar::PxarExtractOptions { match_list: &[], diff --git a/proxmox-backup-client/src/mount.rs b/proxmox-backup-client/src/mount.rs index b69e7e803..d96690839 100644 --- a/proxmox-backup-client/src/mount.rs +++ b/proxmox-backup-client/src/mount.rs @@ -302,7 +302,7 @@ async fn mount_do(param: Value, pipe: Option) -> Result { } } } else if server_archive_name.ends_with(".fidx") { - let file_info = manifest.lookup_file_info(&archive_name)?; + let file_info = manifest.lookup_file_info(archive_name)?; let index = client .download_fixed_index(&manifest, &server_archive_name) .await?; diff --git a/proxmox-file-restore/src/main.rs b/proxmox-file-restore/src/main.rs index 3dc2b3fd9..8104600d7 100644 --- a/proxmox-file-restore/src/main.rs +++ b/proxmox-file-restore/src/main.rs @@ -188,7 +188,7 @@ async fn list_files( pbs_client::tools::pxar_metadata_catalog_lookup( accessor, - &path, + path, Some(&archive_name), ) .await @@ -364,11 +364,11 @@ async fn get_remote_pxar_reader( crypt_config: Option>, ) -> Result<(LocalDynamicReadAt, u64), Error> { let index = client - .download_dynamic_index(&manifest, &archive_name) + .download_dynamic_index(manifest, archive_name) .await?; let most_used = index.find_most_used_chunks(8); - let file_info = manifest.lookup_file_info(&archive_name)?; + let file_info = manifest.lookup_file_info(archive_name)?; let chunk_reader = RemoteChunkReader::new( client.clone(), crypt_config, diff --git a/pxar-bin/src/main.rs b/pxar-bin/src/main.rs index e62348e25..6549ccf13 100644 --- a/pxar-bin/src/main.rs +++ b/pxar-bin/src/main.rs @@ -233,7 +233,7 @@ fn extract_archive( overwrite_flags, extract_match_default, on_error, - prelude_path: prelude_target.map(|path| PathBuf::from(path)), + prelude_path: prelude_target.map(PathBuf::from), }; if archive == "-" { @@ -477,7 +477,7 @@ async fn mount_archive( let archive = Path::new(&archive); let mountpoint = Path::new(&mountpoint); let options = OsStr::new("ro,default_permissions"); - let payload_input = payload_input.map(|payload_input| PathBuf::from(payload_input)); + let payload_input = payload_input.map(PathBuf::from); let session = pbs_pxar_fuse::Session::mount_path( archive, diff --git a/pxar-bin/tests/pxar.rs b/pxar-bin/tests/pxar.rs index 0a4fbcad5..23559bad6 100644 --- a/pxar-bin/tests/pxar.rs +++ b/pxar-bin/tests/pxar.rs @@ -7,7 +7,7 @@ fn pxar_create_and_extract() { let src_dir = "../tests/catar_data/test_xattrs_src/"; let dest_dir = "../tests/catar_data/test_xattrs_dest/"; - let target_subdir = std::env::var("DEB_HOST_RUST_TYPE").unwrap_or(String::new()); + let target_subdir = std::env::var("DEB_HOST_RUST_TYPE").unwrap_or_default(); let exec_path = if cfg!(debug_assertions) { format!("../target/{target_subdir}/debug/pxar") @@ -83,7 +83,7 @@ fn pxar_create_and_extract() { #[test] fn pxar_list_with_payload_input() { - let target_subdir = std::env::var("DEB_HOST_RUST_TYPE").unwrap_or(String::new()); + let target_subdir = std::env::var("DEB_HOST_RUST_TYPE").unwrap_or_default(); let exec_path = if cfg!(debug_assertions) { format!("../target/{target_subdir}/debug/pxar") @@ -91,7 +91,7 @@ fn pxar_list_with_payload_input() { format!("../target/{target_subdir}/release/pxar") }; - let output = Command::new(&exec_path) + let output = Command::new(exec_path) .args([ "list", "../tests/pxar/backup-client-pxar-expected.mpxar", diff --git a/src/api2/tape/restore.rs b/src/api2/tape/restore.rs index 2b2025f6d..7b96acb6c 100644 --- a/src/api2/tape/restore.rs +++ b/src/api2/tape/restore.rs @@ -479,7 +479,7 @@ fn restore_full_worker( if encryption_key_fingerprint.is_none() && set.encryption_key_fingerprint.is_some() { - encryption_key_fingerprint = set.encryption_key_fingerprint.clone(); + encryption_key_fingerprint.clone_from(&set.encryption_key_fingerprint); } } media_id_list.push(media_id); diff --git a/src/bin/proxmox_backup_debug/api.rs b/src/bin/proxmox_backup_debug/api.rs index 42fa51f41..7a5e49846 100644 --- a/src/bin/proxmox_backup_debug/api.rs +++ b/src/bin/proxmox_backup_debug/api.rs @@ -79,7 +79,7 @@ async fn complete_api_path_do(mut complete_me: &str, capability: Option<&str>) - if list.len() == 1 && old_len != 1 && list[0].ends_with('/') { // we added only one match and it was a directory, lookup again - lookup_path = list[0].clone(); + lookup_path.clone_from(&list[0]); filter = ""; continue; } diff --git a/src/server/realm_sync_job.rs b/src/server/realm_sync_job.rs index 31412be87..8f5d95fdf 100644 --- a/src/server/realm_sync_job.rs +++ b/src/server/realm_sync_job.rs @@ -463,9 +463,9 @@ impl LdapSyncSettings { let value = LdapSyncAttributes::API_SCHEMA.parse_property_string(sync_attributes)?; let sync_attributes: LdapSyncAttributes = serde_json::from_value(value)?; - email = sync_attributes.email.clone(); - firstname = sync_attributes.firstname.clone(); - lastname = sync_attributes.lastname.clone(); + email.clone_from(&sync_attributes.email); + firstname.clone_from(&sync_attributes.firstname); + lastname.clone_from(&sync_attributes.lastname); if let Some(email_attr) = &sync_attributes.email { attributes.push(email_attr.clone()); diff --git a/src/tools/disks/mod.rs b/src/tools/disks/mod.rs index 94f89e0a9..75afa9c53 100644 --- a/src/tools/disks/mod.rs +++ b/src/tools/disks/mod.rs @@ -902,7 +902,7 @@ fn get_partitions_info( _ => used, }; if used == PartitionUsageType::FileSystem { - filesystem = info.file_system_type.clone(); + filesystem.clone_from(&info.file_system_type); } } }