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/2] tui: fix clippy warnings
Date: Mon, 10 Jul 2023 15:26:25 +0200	[thread overview]
Message-ID: <20230710132632.512643-2-c.heiss@proxmox.com> (raw)
In-Reply-To: <20230710132632.512643-1-c.heiss@proxmox.com>

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





  reply	other threads:[~2023-07-10 13:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10 13:26 [pve-devel] [PATCH installer 0/2] tui: add "Deselect all" disks button for zfs/btrfs raid Christoph Heiss
2023-07-10 13:26 ` Christoph Heiss [this message]
2023-07-10 13:26 ` [pve-devel] [PATCH installer 2/2] tui: add "Deselect all" button to zfs/btrfs raid disk select Christoph Heiss
2023-07-13 14:10 ` [pve-devel] applied: [PATCH installer 0/2] tui: add "Deselect all" disks button for zfs/btrfs raid Thomas Lamprecht

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=20230710132632.512643-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