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

Maximiliano Sandoval m.sandoval at proxmox.com
Wed Jun 26 14:43:45 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 | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/proxmox-acme-api/src/certificate_helpers.rs b/proxmox-acme-api/src/certificate_helpers.rs
index dd8385e2..3af762b1 100644
--- a/proxmox-acme-api/src/certificate_helpers.rs
+++ b/proxmox-acme-api/src/certificate_helpers.rs
@@ -343,10 +343,8 @@ 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
+                            name.uri().map(|uri| format!("URI: {uri}"))
                         }
                     })
                     .collect()
-- 
2.39.2





More information about the pbs-devel mailing list