trivial clippy fixes
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
f699c72b20
commit
8aa244641d
@ -1835,7 +1835,7 @@ mod tests {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extractor.enter_directory(
|
extractor.enter_directory(
|
||||||
OsString::from(format!("testdir")),
|
OsString::from("testdir".to_string()),
|
||||||
dir_metadata.clone(),
|
dir_metadata.clone(),
|
||||||
true,
|
true,
|
||||||
)?;
|
)?;
|
||||||
|
@ -571,11 +571,9 @@ mod tests {
|
|||||||
};
|
};
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
String::try_from(nw_config).unwrap().trim(),
|
String::try_from(nw_config).unwrap().trim(),
|
||||||
format!(
|
r#"
|
||||||
r#"
|
|
||||||
iface enp3s0 inet static
|
iface enp3s0 inet static
|
||||||
address 10.0.0.100/16"#
|
address 10.0.0.100/16"#.to_string()
|
||||||
)
|
|
||||||
.trim()
|
.trim()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -596,12 +594,10 @@ iface enp3s0 inet static
|
|||||||
};
|
};
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
String::try_from(nw_config).unwrap().trim(),
|
String::try_from(nw_config).unwrap().trim(),
|
||||||
format!(
|
r#"
|
||||||
r#"
|
|
||||||
iface enp3s0 inet static
|
iface enp3s0 inet static
|
||||||
address 10.0.0.100/16
|
address 10.0.0.100/16
|
||||||
gateway 10.0.0.1"#
|
gateway 10.0.0.1"#.to_string()
|
||||||
)
|
|
||||||
.trim()
|
.trim()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -412,9 +412,9 @@ pub fn read_element_status<F: AsRawFd>(file: &mut F) -> Result<MtxStatus, Error>
|
|||||||
for drive in drives.iter_mut() {
|
for drive in drives.iter_mut() {
|
||||||
for drive2 in &page.drives {
|
for drive2 in &page.drives {
|
||||||
if drive2.element_address == drive.element_address {
|
if drive2.element_address == drive.element_address {
|
||||||
drive.vendor = drive2.vendor.clone();
|
drive.vendor.clone_from(&drive2.vendor);
|
||||||
drive.model = drive2.model.clone();
|
drive.model.clone_from(&drive2.model);
|
||||||
drive.drive_serial_number = drive2.drive_serial_number.clone();
|
drive.drive_serial_number.clone_from(&drive2.drive_serial_number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ pub(crate) async fn get_pxar_fuse_accessor(
|
|||||||
crypt_config: Option<Arc<CryptConfig>>,
|
crypt_config: Option<Arc<CryptConfig>>,
|
||||||
) -> Result<pbs_pxar_fuse::Accessor, Error> {
|
) -> Result<pbs_pxar_fuse::Accessor, Error> {
|
||||||
let (archive_name, payload_archive_name) =
|
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(
|
let (reader, archive_size) = get_pxar_fuse_reader(
|
||||||
&archive_name,
|
&archive_name,
|
||||||
|
@ -256,7 +256,7 @@ async fn backup_directory<P: AsRef<Path>>(
|
|||||||
});
|
});
|
||||||
|
|
||||||
let payload_stats = client.upload_stream(
|
let payload_stats = client.upload_stream(
|
||||||
&payload_target,
|
payload_target,
|
||||||
stream,
|
stream,
|
||||||
upload_options,
|
upload_options,
|
||||||
Some(payload_injections_rx),
|
Some(payload_injections_rx),
|
||||||
@ -1641,7 +1641,7 @@ async fn restore(
|
|||||||
|
|
||||||
let prelude_path = param["prelude-target"]
|
let prelude_path = param["prelude-target"]
|
||||||
.as_str()
|
.as_str()
|
||||||
.map(|path| PathBuf::from(path));
|
.map(PathBuf::from);
|
||||||
|
|
||||||
let options = pbs_client::pxar::PxarExtractOptions {
|
let options = pbs_client::pxar::PxarExtractOptions {
|
||||||
match_list: &[],
|
match_list: &[],
|
||||||
|
@ -302,7 +302,7 @@ async fn mount_do(param: Value, pipe: Option<OwnedFd>) -> Result<Value, Error> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if server_archive_name.ends_with(".fidx") {
|
} 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
|
let index = client
|
||||||
.download_fixed_index(&manifest, &server_archive_name)
|
.download_fixed_index(&manifest, &server_archive_name)
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -188,7 +188,7 @@ async fn list_files(
|
|||||||
|
|
||||||
pbs_client::tools::pxar_metadata_catalog_lookup(
|
pbs_client::tools::pxar_metadata_catalog_lookup(
|
||||||
accessor,
|
accessor,
|
||||||
&path,
|
path,
|
||||||
Some(&archive_name),
|
Some(&archive_name),
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
@ -364,11 +364,11 @@ async fn get_remote_pxar_reader(
|
|||||||
crypt_config: Option<Arc<CryptConfig>>,
|
crypt_config: Option<Arc<CryptConfig>>,
|
||||||
) -> Result<(LocalDynamicReadAt<RemoteChunkReader>, u64), Error> {
|
) -> Result<(LocalDynamicReadAt<RemoteChunkReader>, u64), Error> {
|
||||||
let index = client
|
let index = client
|
||||||
.download_dynamic_index(&manifest, &archive_name)
|
.download_dynamic_index(manifest, archive_name)
|
||||||
.await?;
|
.await?;
|
||||||
let most_used = index.find_most_used_chunks(8);
|
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(
|
let chunk_reader = RemoteChunkReader::new(
|
||||||
client.clone(),
|
client.clone(),
|
||||||
crypt_config,
|
crypt_config,
|
||||||
|
@ -233,7 +233,7 @@ fn extract_archive(
|
|||||||
overwrite_flags,
|
overwrite_flags,
|
||||||
extract_match_default,
|
extract_match_default,
|
||||||
on_error,
|
on_error,
|
||||||
prelude_path: prelude_target.map(|path| PathBuf::from(path)),
|
prelude_path: prelude_target.map(PathBuf::from),
|
||||||
};
|
};
|
||||||
|
|
||||||
if archive == "-" {
|
if archive == "-" {
|
||||||
@ -477,7 +477,7 @@ async fn mount_archive(
|
|||||||
let archive = Path::new(&archive);
|
let archive = Path::new(&archive);
|
||||||
let mountpoint = Path::new(&mountpoint);
|
let mountpoint = Path::new(&mountpoint);
|
||||||
let options = OsStr::new("ro,default_permissions");
|
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(
|
let session = pbs_pxar_fuse::Session::mount_path(
|
||||||
archive,
|
archive,
|
||||||
|
@ -7,7 +7,7 @@ fn pxar_create_and_extract() {
|
|||||||
let src_dir = "../tests/catar_data/test_xattrs_src/";
|
let src_dir = "../tests/catar_data/test_xattrs_src/";
|
||||||
let dest_dir = "../tests/catar_data/test_xattrs_dest/";
|
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) {
|
let exec_path = if cfg!(debug_assertions) {
|
||||||
format!("../target/{target_subdir}/debug/pxar")
|
format!("../target/{target_subdir}/debug/pxar")
|
||||||
@ -83,7 +83,7 @@ fn pxar_create_and_extract() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn pxar_list_with_payload_input() {
|
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) {
|
let exec_path = if cfg!(debug_assertions) {
|
||||||
format!("../target/{target_subdir}/debug/pxar")
|
format!("../target/{target_subdir}/debug/pxar")
|
||||||
@ -91,7 +91,7 @@ fn pxar_list_with_payload_input() {
|
|||||||
format!("../target/{target_subdir}/release/pxar")
|
format!("../target/{target_subdir}/release/pxar")
|
||||||
};
|
};
|
||||||
|
|
||||||
let output = Command::new(&exec_path)
|
let output = Command::new(exec_path)
|
||||||
.args([
|
.args([
|
||||||
"list",
|
"list",
|
||||||
"../tests/pxar/backup-client-pxar-expected.mpxar",
|
"../tests/pxar/backup-client-pxar-expected.mpxar",
|
||||||
|
@ -479,7 +479,7 @@ fn restore_full_worker(
|
|||||||
if encryption_key_fingerprint.is_none()
|
if encryption_key_fingerprint.is_none()
|
||||||
&& set.encryption_key_fingerprint.is_some()
|
&& 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);
|
media_id_list.push(media_id);
|
||||||
|
@ -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('/') {
|
if list.len() == 1 && old_len != 1 && list[0].ends_with('/') {
|
||||||
// we added only one match and it was a directory, lookup again
|
// we added only one match and it was a directory, lookup again
|
||||||
lookup_path = list[0].clone();
|
lookup_path.clone_from(&list[0]);
|
||||||
filter = "";
|
filter = "";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -463,9 +463,9 @@ impl LdapSyncSettings {
|
|||||||
let value = LdapSyncAttributes::API_SCHEMA.parse_property_string(sync_attributes)?;
|
let value = LdapSyncAttributes::API_SCHEMA.parse_property_string(sync_attributes)?;
|
||||||
let sync_attributes: LdapSyncAttributes = serde_json::from_value(value)?;
|
let sync_attributes: LdapSyncAttributes = serde_json::from_value(value)?;
|
||||||
|
|
||||||
email = sync_attributes.email.clone();
|
email.clone_from(&sync_attributes.email);
|
||||||
firstname = sync_attributes.firstname.clone();
|
firstname.clone_from(&sync_attributes.firstname);
|
||||||
lastname = sync_attributes.lastname.clone();
|
lastname.clone_from(&sync_attributes.lastname);
|
||||||
|
|
||||||
if let Some(email_attr) = &sync_attributes.email {
|
if let Some(email_attr) = &sync_attributes.email {
|
||||||
attributes.push(email_attr.clone());
|
attributes.push(email_attr.clone());
|
||||||
|
@ -902,7 +902,7 @@ fn get_partitions_info(
|
|||||||
_ => used,
|
_ => used,
|
||||||
};
|
};
|
||||||
if used == PartitionUsageType::FileSystem {
|
if used == PartitionUsageType::FileSystem {
|
||||||
filesystem = info.file_system_type.clone();
|
filesystem.clone_from(&info.file_system_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user