From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <c.heiss@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 47079CB88
 for <pve-devel@lists.proxmox.com>; Mon, 10 Jul 2023 15:27:07 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 2897A181BB
 for <pve-devel@lists.proxmox.com>; Mon, 10 Jul 2023 15:26:37 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pve-devel@lists.proxmox.com>; Mon, 10 Jul 2023 15:26:36 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id C31D6428F4
 for <pve-devel@lists.proxmox.com>; Mon, 10 Jul 2023 15:26:35 +0200 (CEST)
From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Mon, 10 Jul 2023 15:26:25 +0200
Message-ID: <20230710132632.512643-2-c.heiss@proxmox.com>
X-Mailer: git-send-email 2.41.0
In-Reply-To: <20230710132632.512643-1-c.heiss@proxmox.com>
References: <20230710132632.512643-1-c.heiss@proxmox.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.065 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
 T_SCC_BODY_TEXT_LINE    -0.01 -
Subject: [pve-devel] [PATCH installer 1/2] tui: fix clippy warnings
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Mon, 10 Jul 2023 13:27:07 -0000

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 proxmox-tui-installer/src/options.rs        | 6 +-----
 proxmox-tui-installer/src/setup.rs          | 8 ++------
 proxmox-tui-installer/src/views/bootdisk.rs | 4 ++--
 3 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/proxmox-tui-installer/src/options.rs b/proxmox-tui-installer/src/options.rs
index 62804c2..c8e8215 100644
--- a/proxmox-tui-installer/src/options.rs
+++ b/proxmox-tui-installer/src/options.rs
@@ -57,11 +57,7 @@ pub enum FsType {
 
 impl FsType {
     pub fn is_btrfs(&self) -> bool {
-        use FsType::Btrfs;
-        match self {
-            Btrfs(_) => true,
-            _ => false,
-        }
+        matches!(self, FsType::Btrfs(_))
     }
 }
 
diff --git a/proxmox-tui-installer/src/setup.rs b/proxmox-tui-installer/src/setup.rs
index 68207c8..e8ee7f3 100644
--- a/proxmox-tui-installer/src/setup.rs
+++ b/proxmox-tui-installer/src/setup.rs
@@ -206,23 +206,19 @@ impl From<InstallerOptions> for InstallConfig {
                 config.hdsize = zfs.disk_size;
                 config.zfs_opts = Some(zfs.clone().into());
 
-                let mut i = 0;
-                for disk in &options.bootdisk.disks {
+                for (i, disk) in options.bootdisk.disks.iter().enumerate() {
                     config
                         .disk_selection
                         .insert(i.to_string(), disk.index.clone());
-                    i = i + 1;
                 }
             }
             AdvancedBootdiskOptions::Btrfs(btrfs) => {
                 config.hdsize = btrfs.disk_size;
 
-                let mut i = 0;
-                for disk in &options.bootdisk.disks {
+                for (i, disk) in options.bootdisk.disks.iter().enumerate() {
                     config
                         .disk_selection
                         .insert(i.to_string(), disk.index.clone());
-                    i = i + 1;
                 }
             }
         }
diff --git a/proxmox-tui-installer/src/views/bootdisk.rs b/proxmox-tui-installer/src/views/bootdisk.rs
index 602e1da..4970655 100644
--- a/proxmox-tui-installer/src/views/bootdisk.rs
+++ b/proxmox-tui-installer/src/views/bootdisk.rs
@@ -274,7 +274,7 @@ struct MultiDiskOptionsView<T> {
 }
 
 impl<T: View> MultiDiskOptionsView<T> {
-    fn new(avail_disks: &[Disk], selected_disks: &Vec<usize>, options_view: T) -> Self {
+    fn new(avail_disks: &[Disk], selected_disks: &[usize], options_view: T) -> Self {
         let mut selectable_disks = avail_disks
             .iter()
             .map(|d| (d.to_string(), Some(d.clone())))
@@ -283,7 +283,7 @@ impl<T: View> MultiDiskOptionsView<T> {
         selectable_disks.push(("-- do not use --".to_owned(), None));
 
         let mut disk_form = FormView::new();
-        for i in 0..avail_disks.len() {
+        for (i, _) in avail_disks.iter().enumerate() {
             disk_form.add_child(
                 &format!("Harddisk {i}"),
                 SelectView::new()
-- 
2.41.0