[pbs-devel] [PATCH v2 backup 4/5] clippy fixes: Box::new(_) of default value

Maximiliano Sandoval m.sandoval at proxmox.com
Fri Jun 16 10:27:30 CEST 2023


>From rust-lang:

> Why is this bad?
>
> First, it’s more complex, involving two calls instead of one. Second,
> Box::default() can be faster in certain cases.

Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
 src/acme/plugin.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/acme/plugin.rs b/src/acme/plugin.rs
index 478d0666..5fe8993d 100644
--- a/src/acme/plugin.rs
+++ b/src/acme/plugin.rs
@@ -35,7 +35,7 @@ pub(crate) fn get_acme_plugin(
         }
         "standalone" => {
             // this one has no config
-            Box::new(StandaloneServer::default())
+            Box::<StandaloneServer>::default()
         }
         other => bail!("missing implementation for plugin type '{}'", other),
     }))
-- 
2.39.2






More information about the pbs-devel mailing list