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

Daniele Paoni daniele at libertyline.com
Fri Jun 16 10:38:01 CEST 2023


Yk

In data 16 giugno 2023 10:27:35 Maximiliano Sandoval 
<m.sandoval at proxmox.com> ha scritto:

> 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
>
>
>
> _______________________________________________
> pbs-devel mailing list
> pbs-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.proxmox.com/pipermail/pbs-devel/attachments/20230616/a2c61fd6/attachment.htm>


More information about the pbs-devel mailing list