trivial clippy fixes

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2024-06-24 09:59:27 +02:00
parent f699c72b20
commit 8aa244641d
13 changed files with 26 additions and 30 deletions

View File

@ -1835,7 +1835,7 @@ mod tests {
};
extractor.enter_directory(
OsString::from(format!("testdir")),
OsString::from("testdir".to_string()),
dir_metadata.clone(),
true,
)?;

View 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()
);
}

View 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);
}
}
}

View 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,

View 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: &[],

View 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?;

View 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,

View 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,

View 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",

View 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);

View 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;
}

View 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());

View 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);
}
}
}