[pdm-devel] [PATCH datacenter-manager 2/2] ui: use new `iter()` method of ArrayMap properties

Dominik Csapak d.csapak at proxmox.com
Thu Jan 16 10:22:27 CET 2025


they now can be directly referenced with that, instead of going over the
ArrayMap `Deref` and using `.into_iter()`.

Makes the code a bit clearer since the ref/deref syntax looks a bit
strange.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 ui/src/pve/utils.rs | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/ui/src/pve/utils.rs b/ui/src/pve/utils.rs
index 3cb45a9..bb02f56 100644
--- a/ui/src/pve/utils.rs
+++ b/ui/src/pve/utils.rs
@@ -152,7 +152,7 @@ pub fn foreach_drive_qemu<F>(config: &QemuConfig, mut f: F)
 where
     F: FnMut(&str, Result<PveDriveQemu, Error>),
 {
-    for (idx, value) in (&*config.ide).into_iter() {
+    for (idx, value) in config.ide.iter() {
         let key = format!("ide{idx}");
         let res = value
             .parse::<PropertyString<PveQmIde>>()
@@ -160,7 +160,7 @@ where
         f(&key, res.map_err(Error::from));
     }
 
-    for (idx, value) in (&*config.sata).into_iter() {
+    for (idx, value) in config.sata.iter() {
         let key = format!("sata{idx}");
         let res = value
             .parse::<PropertyString<QemuConfigSata>>()
@@ -168,7 +168,7 @@ where
         f(&key, res.map_err(Error::from));
     }
 
-    for (idx, value) in (&*config.scsi).into_iter() {
+    for (idx, value) in config.scsi.iter() {
         let key = format!("scsi{idx}");
         let res = value
             .parse::<PropertyString<QemuConfigScsi>>()
@@ -176,7 +176,7 @@ where
         f(&key, res.map_err(Error::from));
     }
 
-    for (idx, value) in (&*config.virtio).into_iter() {
+    for (idx, value) in config.virtio.iter() {
         let key = format!("virtio{idx}");
         let res = value
             .parse::<PropertyString<QemuConfigVirtio>>()
@@ -184,7 +184,7 @@ where
         f(&key, res.map_err(Error::from));
     }
 
-    for (idx, value) in (&*config.unused).into_iter() {
+    for (idx, value) in config.unused.iter() {
         let key = format!("unused{idx}");
         let res = value
             .parse::<PropertyString<QemuConfigUnused>>()
@@ -224,7 +224,7 @@ where
         f(key, res.map_err(Error::from));
     }
 
-    for (idx, value) in (&*config.mp).into_iter() {
+    for (idx, value) in config.mp.iter() {
         let key = format!("mp{idx}");
         let res = value
             .parse::<PropertyString<LxcConfigMp>>()
@@ -232,7 +232,7 @@ where
         f(&key, res.map_err(Error::from));
     }
 
-    for (idx, value) in (&*config.unused).into_iter() {
+    for (idx, value) in config.unused.iter() {
         let key = format!("unused{idx}");
         let res = value
             .parse::<PropertyString<LxcConfigUnused>>()
-- 
2.39.5





More information about the pdm-devel mailing list