public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer 1/4] tree-wide: run rustfmt, fix clippy warnings
Date: Tue,  7 May 2024 15:21:34 +0200	[thread overview]
Message-ID: <20240507132220.1218652-2-c.heiss@proxmox.com> (raw)
In-Reply-To: <20240507132220.1218652-1-c.heiss@proxmox.com>

No functional changes.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 proxmox-auto-installer/tests/parse-answer.rs       | 14 +++++++-------
 .../src/fetch_plugins/partition.rs                 | 10 +++++-----
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/proxmox-auto-installer/tests/parse-answer.rs b/proxmox-auto-installer/tests/parse-answer.rs
index 4014b6d..e77a769 100644
--- a/proxmox-auto-installer/tests/parse-answer.rs
+++ b/proxmox-auto-installer/tests/parse-answer.rs
@@ -1,4 +1,4 @@
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};

 use serde_json::Value;
 use std::fs;
@@ -24,9 +24,9 @@ fn get_answer(path: PathBuf) -> Result<Answer, String> {
     Ok(answer)
 }

-fn setup_test_basic(path: &PathBuf) -> (SetupInfo, LocaleInfo, RuntimeInfo, UdevInfo) {
+fn setup_test_basic(path: &Path) -> (SetupInfo, LocaleInfo, RuntimeInfo, UdevInfo) {
     let installer_info: SetupInfo = {
-        let mut path = path.clone();
+        let mut path = path.to_path_buf();
         path.push("iso-info.json");

         read_json(&path)
@@ -35,7 +35,7 @@ fn setup_test_basic(path: &PathBuf) -> (SetupInfo, LocaleInfo, RuntimeInfo, Udev
     };

     let locale_info = {
-        let mut path = path.clone();
+        let mut path = path.to_path_buf();
         path.push("locales.json");

         read_json(&path)
@@ -44,7 +44,7 @@ fn setup_test_basic(path: &PathBuf) -> (SetupInfo, LocaleInfo, RuntimeInfo, Udev
     };

     let mut runtime_info: RuntimeInfo = {
-        let mut path = path.clone();
+        let mut path = path.to_path_buf();
         path.push("run-env-info.json");

         read_json(&path)
@@ -53,7 +53,7 @@ fn setup_test_basic(path: &PathBuf) -> (SetupInfo, LocaleInfo, RuntimeInfo, Udev
     };

     let udev_info: UdevInfo = {
-        let mut path = path.clone();
+        let mut path = path.to_path_buf();
         path.push("run-env-udev.json");

         read_json(&path)
@@ -71,7 +71,7 @@ fn setup_test_basic(path: &PathBuf) -> (SetupInfo, LocaleInfo, RuntimeInfo, Udev
 fn test_parse_answers() {
     let path = get_test_resource_path().unwrap();
     let (setup_info, locales, runtime_info, udev_info) = setup_test_basic(&path);
-    let mut tests_path = path.clone();
+    let mut tests_path = path;
     tests_path.push("parse_answer");
     let test_dir = fs::read_dir(tests_path.clone()).unwrap();

diff --git a/proxmox-fetch-answer/src/fetch_plugins/partition.rs b/proxmox-fetch-answer/src/fetch_plugins/partition.rs
index 0479c8f..7213493 100644
--- a/proxmox-fetch-answer/src/fetch_plugins/partition.rs
+++ b/proxmox-fetch-answer/src/fetch_plugins/partition.rs
@@ -31,7 +31,7 @@ impl FetchFromPartition {
 }

 fn path_exists_logged(file_name: &str, search_path: &str) -> Option<PathBuf> {
-    let path = Path::new(search_path).join(&file_name);
+    let path = Path::new(search_path).join(file_name);
     info!("Testing partition search path {path:?}");
     match path.try_exists() {
         Ok(true) => Some(path),
@@ -51,14 +51,14 @@ fn path_exists_logged(file_name: &str, search_path: &str) -> Option<PathBuf> {
 fn scan_partlabels(partlabel: &str, search_path: &str) -> Result<PathBuf> {
     let partlabel_upper_case = partlabel.to_uppercase();
     if let Some(path) = path_exists_logged(&partlabel_upper_case, search_path) {
-            info!("Found partition with label '{partlabel_upper_case}'");
-            return Ok(path);
+        info!("Found partition with label '{partlabel_upper_case}'");
+        return Ok(path);
     }

     let partlabel_lower_case = partlabel.to_lowercase();
     if let Some(path) = path_exists_logged(&partlabel_lower_case, search_path) {
-            info!("Found partition with label '{partlabel_lower_case}'");
-            return Ok(path);
+        info!("Found partition with label '{partlabel_lower_case}'");
+        return Ok(path);
     }

     bail!("Could not detect upper or lower case labels for '{partlabel}'");
--
2.44.0



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  reply	other threads:[~2024-05-07 13:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-07 13:21 [pve-devel] [PATCH installer 0/4] assistant: clean up glob patterns & regexes Christoph Heiss
2024-05-07 13:21 ` Christoph Heiss [this message]
2024-05-07 13:21 ` [pve-devel] [PATCH installer 2/4] assistant: drop unused `log` dependency Christoph Heiss
2024-05-07 13:21 ` [pve-devel] [PATCH installer 3/4] assistant: pre-compile ignored block device patterns Christoph Heiss
2024-05-07 13:21 ` [pve-devel] [PATCH installer 4/4] assistant: avoid regex for simple prefix matching Christoph Heiss
2024-05-13  9:18 ` [pve-devel] [PATCH installer 0/4] assistant: clean up glob patterns & regexes Aaron Lauterer
2024-05-13  9:50   ` Christoph Heiss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240507132220.1218652-2-c.heiss@proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal