From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 4918C1FF38E for ; Mon, 13 May 2024 11:49:39 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E147312450; Mon, 13 May 2024 11:49:46 +0200 (CEST) From: Christoph Heiss To: pve-devel@lists.proxmox.com Date: Mon, 13 May 2024 11:49:09 +0200 Message-ID: <20240513094936.412650-2-c.heiss@proxmox.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240513094936.412650-1-c.heiss@proxmox.com> References: <20240513094936.412650-1-c.heiss@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.005 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH installer v2 1/4] tree-wide: run rustfmt, fix clippy warnings X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" No functional changes. Signed-off-by: Christoph Heiss --- Changes v1 -> v2: * no changes 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 { 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 { - 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 { fn scan_partlabels(partlabel: &str, search_path: &str) -> Result { 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