]> git.proxmox.com Git - proxmox-backup.git/commitdiff
trivial clippy fixes
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 24 Jun 2024 07:59:27 +0000 (09:59 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 24 Jun 2024 07:59:27 +0000 (09:59 +0200)
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
13 files changed:
pbs-client/src/pxar/create.rs
pbs-config/src/network/mod.rs
pbs-tape/src/sg_pt_changer.rs
proxmox-backup-client/src/helper.rs
proxmox-backup-client/src/main.rs
proxmox-backup-client/src/mount.rs
proxmox-file-restore/src/main.rs
pxar-bin/src/main.rs
pxar-bin/tests/pxar.rs
src/api2/tape/restore.rs
src/bin/proxmox_backup_debug/api.rs
src/server/realm_sync_job.rs
src/tools/disks/mod.rs

index 30dc192fb7328bb750c149b44010c9fe3de0b894..8b7b5b73196ad57b0217735b2799cc7459050cd1 100644 (file)
@@ -1835,7 +1835,7 @@ mod tests {
         };
 
         extractor.enter_directory(
-            OsString::from(format!("testdir")),
+            OsString::from("testdir".to_string()),
             dir_metadata.clone(),
             true,
         )?;
index 19a2df8cb8399b2939a9f652e5589d7b39160124..14a2c6c3553be0f2a550c928c99acb973d6db2de 100644 (file)
@@ -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()
         );
     }
index 3945d18f3b308abc697373638e2cc0be302bf6f1..f3387756c53403f4de9c825f7e3ee883847757fb 100644 (file)
@@ -412,9 +412,9 @@ pub fn read_element_status<F: AsRawFd>(file: &mut F) -> Result<MtxStatus, Error>
         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);
                 }
             }
         }
index d9d9837aa8dc8c7afa40e57ca65eae42dc7b58e1..60355d7d0e0317d23f2a48e6777a47ff83c71020 100644 (file)
@@ -14,7 +14,7 @@ pub(crate) async fn get_pxar_fuse_accessor(
     crypt_config: Option<Arc<CryptConfig>>,
 ) -> Result<pbs_pxar_fuse::Accessor, Error> {
     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,
index 5f694b11ed7196e7bf4d46a1e8ea4459303c6065..ecd7b9e9f45c0a97e72b550de87d8a1804c95c8a 100644 (file)
@@ -256,7 +256,7 @@ async fn backup_directory<P: AsRef<Path>>(
         });
 
         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: &[],
index b69e7e803f660f3a8a9fd8d70bb388d54f50b66a..d96690839f87ce35e9f5d5c997cf88b52fda2386 100644 (file)
@@ -302,7 +302,7 @@ async fn mount_do(param: Value, pipe: Option<OwnedFd>) -> Result<Value, Error> {
             }
         }
     } 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?;
index 3dc2b3fd9f8247467cfd9514d76f4bdaa09f3d98..8104600d7c94142c4a5fd3867fa211d13f1fac06 100644 (file)
@@ -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<Arc<CryptConfig>>,
 ) -> Result<(LocalDynamicReadAt<RemoteChunkReader>, 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,
index e62348e251ab5a3f6a5f9822a17764ebb8492c22..6549ccf13963c59af40031707b7d9082bfe3b580 100644 (file)
@@ -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,
index 0a4fbcad5e9cde98637914a8055270e6f6534dbe..23559bad619c944ecef821899a8aa2800c93a099 100644 (file)
@@ -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",
index 2b2025f6d22ad6c962f69ff3c41f39c58826e650..7b96acb6c5b0207e16e75b3e7a24ff13b951ba44 100644 (file)
@@ -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);
index 42fa51f414b30cf6b5320c53b931e8a8a3a6f49b..7a5e498460fc502a2efb1f18f697ce61eefc8d8d 100644 (file)
@@ -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;
         }
index 31412be87f7523c91689c1f2d25623281c6e4732..8f5d95fdf4fa06702121a5b2454c30991d6bb7a0 100644 (file)
@@ -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());
index 94f89e0a9ae8fe03aad88554708c98585a59b8c0..75afa9c53daf6c5a811de012860952380aee1376 100644 (file)
@@ -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);
                     }
                 }
             }