From 5ea70421b3c687cacc36935957c9bd26eff3f56e Mon Sep 17 00:00:00 2001 From: Lukas Wagner Date: Tue, 8 Aug 2023 11:44:54 +0200 Subject: [PATCH] clippy fix: casting to the same type is unnecessary See: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast Signed-off-by: Lukas Wagner --- 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 3201d6ad..6157f8bc 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 { // -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 {