[pve-devel] [PATCH installer 1/4] tree-wide: run rustfmt, fix clippy warnings
Christoph Heiss
c.heiss at proxmox.com
Tue May 7 15:21:34 CEST 2024
No functional changes.
Signed-off-by: Christoph Heiss <c.heiss at 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
More information about the pve-devel
mailing list