[pbs-devel] applied: [PATCH v2 proxmox] clippy fix: casting to the same type is unnecessary

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Aug 8 11:48:23 CEST 2023


applied, thanks

On Tue, Aug 08, 2023 at 11:44:54AM +0200, Lukas Wagner wrote:
> See: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
> 
> Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
> ---
>  proxmox-time/src/posix.rs | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/proxmox-time/src/posix.rs b/proxmox-time/src/posix.rs
> index 3201d6a..6157f8b 100644
> --- a/proxmox-time/src/posix.rs
> +++ b/proxmox-time/src/posix.rs
> @@ -137,6 +137,10 @@ pub fn strftime(format: &str, t: &libc::tm) -> Result<String, Error> {
>          // -1,, it's unsigned
>          bail!("strftime failed");
>      }
> +
> +    // `res` is a `libc::size_t`, which on a different target architecture might not be directly
> +    // assignable to a `usize`. Thus, we actually want a cast here.
> +    #[allow(clippy::unnecessary_cast)]
>      let len = res as usize;
>  
>      if len == 0 {
> -- 
> 2.39.2





More information about the pbs-devel mailing list