From 810c860dbacf1b769c7a58384c77421d9c635f94 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Tue, 23 Apr 2024 10:01:02 +0200 Subject: [PATCH] cargo clippy --fix Signed-off-by: Wolfgang Bumiller --- proxmox-auto-install-assistant/src/main.rs | 2 +- proxmox-auto-installer/src/answer.rs | 4 ++-- proxmox-auto-installer/src/log.rs | 2 +- proxmox-auto-installer/tests/parse-answer.rs | 2 +- proxmox-fetch-answer/src/main.rs | 4 ++-- proxmox-installer-common/src/options.rs | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/proxmox-auto-install-assistant/src/main.rs b/proxmox-auto-install-assistant/src/main.rs index 547af1c..17f8e96 100644 --- a/proxmox-auto-install-assistant/src/main.rs +++ b/proxmox-auto-install-assistant/src/main.rs @@ -340,7 +340,7 @@ fn prepare_iso(args: &CommandPrepareISO) -> Result<()> { inject_file_to_iso(&tmp_iso, &instmode_file_tmp, "/auto-installer-mode.toml")?; if let Some(answer_file) = &args.answer_file { - inject_file_to_iso(&tmp_iso, &answer_file, "/answer.toml")?; + inject_file_to_iso(&tmp_iso, answer_file, "/answer.toml")?; } println!("Moving prepared ISO to target location..."); diff --git a/proxmox-auto-installer/src/answer.rs b/proxmox-auto-installer/src/answer.rs index 59dacd9..de8a360 100644 --- a/proxmox-auto-installer/src/answer.rs +++ b/proxmox-auto-installer/src/answer.rs @@ -163,14 +163,14 @@ impl TryFrom for Disks { lvm_checks(&source)?; ( FsType::Xfs, - FsOptions::LVM(source.lvm.unwrap_or(LvmOptions::default())), + FsOptions::LVM(source.lvm.unwrap_or_default()), ) } Filesystem::Ext4 => { lvm_checks(&source)?; ( FsType::Ext4, - FsOptions::LVM(source.lvm.unwrap_or(LvmOptions::default())), + FsOptions::LVM(source.lvm.unwrap_or_default()), ) } Filesystem::Zfs => { diff --git a/proxmox-auto-installer/src/log.rs b/proxmox-auto-installer/src/log.rs index 67accc4..51b6661 100644 --- a/proxmox-auto-installer/src/log.rs +++ b/proxmox-auto-installer/src/log.rs @@ -29,7 +29,7 @@ impl log::Log for AutoInstLogger { .expect("could not get LOGFILE") .lock() .expect("could not get mutex for LOGFILE"); - write!(file, "{}: {}\n", record.level(), record.args()) + writeln!(file, "{}: {}", record.level(), record.args()) .expect("could not write to LOGFILE"); } } diff --git a/proxmox-auto-installer/tests/parse-answer.rs b/proxmox-auto-installer/tests/parse-answer.rs index c12520f..4014b6d 100644 --- a/proxmox-auto-installer/tests/parse-answer.rs +++ b/proxmox-auto-installer/tests/parse-answer.rs @@ -16,7 +16,7 @@ fn get_test_resource_path() -> Result { .join("tests/resources")) } fn get_answer(path: PathBuf) -> Result { - let answer_raw = std::fs::read_to_string(&path).unwrap(); + let answer_raw = std::fs::read_to_string(path).unwrap(); let answer: answer::Answer = toml::from_str(&answer_raw) .map_err(|err| format!("error parsing answer.toml: {err}")) .unwrap(); diff --git a/proxmox-fetch-answer/src/main.rs b/proxmox-fetch-answer/src/main.rs index 2482f14..df2f65a 100644 --- a/proxmox-fetch-answer/src/main.rs +++ b/proxmox-fetch-answer/src/main.rs @@ -38,7 +38,7 @@ fn fetch_answer(install_settings: &AutoInstSettings) -> Result { } AutoInstModes::Included => { let answer_path = PathBuf::from("/cdrom/answer.toml"); - match fs::read_to_string(&answer_path) { + match fs::read_to_string(answer_path) { Ok(answer) => return Ok(answer), Err(err) => info!("Fetching answer file from ISO failed: {err}"), } @@ -86,5 +86,5 @@ fn main() -> ExitCode { println!("{answer}"); - return ExitCode::SUCCESS; + ExitCode::SUCCESS } diff --git a/proxmox-installer-common/src/options.rs b/proxmox-installer-common/src/options.rs index 1e782f9..c1eafe4 100644 --- a/proxmox-installer-common/src/options.rs +++ b/proxmox-installer-common/src/options.rs @@ -303,7 +303,7 @@ impl TimezoneOptions { let timezone = locales .cczones .get(&country) - .and_then(|zones| zones.get(0)) + .and_then(|zones| zones.first()) .cloned() .unwrap_or_else(|| "UTC".to_owned()); @@ -352,7 +352,7 @@ pub struct NetworkOptions { } impl NetworkOptions { - const DEFAULT_DOMAIN: &str = "example.invalid"; + const DEFAULT_DOMAIN: &'static str = "example.invalid"; pub fn defaults_from(setup: &SetupInfo, network: &NetworkInfo) -> Self { let mut this = Self { -- 2.39.2