* [pbs-devel] [PATCH v2 proxmox] clippy fix: casting to the same type is unnecessary
@ 2023-08-08 9:44 Lukas Wagner
2023-08-08 9:48 ` [pbs-devel] applied: " Wolfgang Bumiller
0 siblings, 1 reply; 2+ messages in thread
From: Lukas Wagner @ 2023-08-08 9:44 UTC (permalink / raw)
To: pbs-devel
See: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Signed-off-by: Lukas Wagner <l.wagner@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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pbs-devel] applied: [PATCH v2 proxmox] clippy fix: casting to the same type is unnecessary
2023-08-08 9:44 [pbs-devel] [PATCH v2 proxmox] clippy fix: casting to the same type is unnecessary Lukas Wagner
@ 2023-08-08 9:48 ` Wolfgang Bumiller
0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Bumiller @ 2023-08-08 9:48 UTC (permalink / raw)
To: Lukas Wagner; +Cc: pbs-devel
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@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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-08 9:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-08 9:44 [pbs-devel] [PATCH v2 proxmox] clippy fix: casting to the same type is unnecessary Lukas Wagner
2023-08-08 9:48 ` [pbs-devel] applied: " Wolfgang Bumiller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox