[pbs-devel] [PATCH proxmox 17/18] acme-api: remove manual implementation of Option::map

Maximiliano Sandoval m.sandoval at proxmox.com
Wed Jun 26 12:45:13 CEST 2024


Fixes the clippy warning:

warning: manual implementation of `Option::map`
   --> proxmox-acme-api/src/certificate_helpers.rs:346:32
    |
346 |                           } else if let Some(uri) = name.uri() {
    |  ________________________________^
347 | |                             Some(format!("URI: {uri}"))
348 | |                         } else {
349 | |                             None
350 | |                         }
    | |_________________________^ help: try: `{ name.uri().map(|uri| format!("URI: {uri}")) }`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
    = note: `#[warn(clippy::manual_map)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
 proxmox-acme-api/src/certificate_helpers.rs | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/proxmox-acme-api/src/certificate_helpers.rs b/proxmox-acme-api/src/certificate_helpers.rs
index dd8385e2..473bd0e1 100644
--- a/proxmox-acme-api/src/certificate_helpers.rs
+++ b/proxmox-acme-api/src/certificate_helpers.rs
@@ -343,11 +343,7 @@ impl CertificateInfo {
                             Some(format!("IP: {ip:?}"))
                         } else if let Some(email) = name.email() {
                             Some(format!("EMAIL: {email}"))
-                        } else if let Some(uri) = name.uri() {
-                            Some(format!("URI: {uri}"))
-                        } else {
-                            None
-                        }
+                        } else { name.uri().map(|uri| format!("URI: {uri}")) }
                     })
                     .collect()
             })
-- 
2.39.2





More information about the pbs-devel mailing list