[pbs-devel] [PATCH proxmox v2 11/18] network-api: remove useless uses of format!

Maximiliano Sandoval m.sandoval at proxmox.com
Wed Jun 26 14:43:39 CEST 2024


Fixes the clippy warning:

warning: useless use of `format!`
   --> proxmox-network-api/src/config/mod.rs:632:13
    |
632 | /             format!(
633 | |                 r#"
634 | | iface enp3s0 inet static
635 | |     address 10.0.0.100/16
636 | |     gateway 10.0.0.1"#
637 | |             )
    | |_____________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
help: consider using `.to_string()`
    |
632 ~             r#"
633 + iface enp3s0 inet static
634 ~     address 10.0.0.100/16
635 ~     gateway 10.0.0.1"#.to_string()

Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
 proxmox-network-api/src/config/mod.rs | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/proxmox-network-api/src/config/mod.rs b/proxmox-network-api/src/config/mod.rs
index b53279e2..22bf9bbb 100644
--- a/proxmox-network-api/src/config/mod.rs
+++ b/proxmox-network-api/src/config/mod.rs
@@ -604,12 +604,11 @@ mod tests {
         };
         assert_eq!(
             String::try_from(nw_config).unwrap().trim(),
-            format!(
-                r#"
+            r#"
 iface enp3s0 inet static
 	address 10.0.0.100/16"#
-            )
-            .trim()
+                .to_string()
+                .trim()
         );
     }
 
@@ -629,13 +628,12 @@ iface enp3s0 inet static
         };
         assert_eq!(
             String::try_from(nw_config).unwrap().trim(),
-            format!(
-                r#"
+            r#"
 iface enp3s0 inet static
 	address 10.0.0.100/16
 	gateway 10.0.0.1"#
-            )
-            .trim()
+                .to_string()
+                .trim()
         );
     }
 
-- 
2.39.2





More information about the pbs-devel mailing list