]> git.proxmox.com Git - pve-installer.git/commitdiff
cargo clippy --fix
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 23 Apr 2024 08:01:02 +0000 (10:01 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 23 Apr 2024 08:02:39 +0000 (10:02 +0200)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
proxmox-auto-install-assistant/src/main.rs
proxmox-auto-installer/src/answer.rs
proxmox-auto-installer/src/log.rs
proxmox-auto-installer/tests/parse-answer.rs
proxmox-fetch-answer/src/main.rs
proxmox-installer-common/src/options.rs

index 547af1c79b04acb3d96248f65d8a9bc3db90128a..17f8e96dd0a64f8443a34933fcd5ef3a40b9c6bb 100644 (file)
@@ -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...");
index 59dacd92b80f6e32f9f7b47f4e3740061737104e..de8a3604deb99f114e00a9994c25521b8fad0488 100644 (file)
@@ -163,14 +163,14 @@ impl TryFrom<DiskSetup> 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 => {
index 67accc4d672c57cc68ea5e43b67d4c7ec6182bf1..51b66619a719a217a472eca77e0dfa6b4c247829 100644 (file)
@@ -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");
         }
     }
index c12520f1936da8f1599cfef5325de0d1cff7784e..4014b6dbffedd73fbc1f591631b872e8e3c07121 100644 (file)
@@ -16,7 +16,7 @@ fn get_test_resource_path() -> Result<PathBuf, String> {
         .join("tests/resources"))
 }
 fn get_answer(path: PathBuf) -> Result<Answer, String> {
-    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();
index 2482f149a57a1dcbf7fac06c03bbeeadda591cd9..df2f65ad876ad383e1e176ac2c68845c3045b42e 100644 (file)
@@ -38,7 +38,7 @@ fn fetch_answer(install_settings: &AutoInstSettings) -> Result<String> {
         }
         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
 }
index 1e782f929818622c94036bbf1b8510422fbe2dc6..c1eafe4c5dde6245cceadc784eab6d3925f464ff 100644 (file)
@@ -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 {