From 6e7bddd1540565a9da7f7e56ddf5851d1786a3dd Mon Sep 17 00:00:00 2001 From: Ryan Zoeller Date: Sat, 8 Oct 2022 13:48:59 -0500 Subject: Fix clippy warnings on nightly Clippy is now smarter about detecting unnecessary casts and useless conversions, which means we need to be more explicit about when the conversions are needed for a subset of platforms. Required changes found by repeatedly running the following command against a list of the supported platforms. `xargs -t -I {} sh -c "cargo clippy -Zbuild-std --target {} --all-targets -- -D warnings || exit 255"` I removed the casts it complained about, and then restored them with an `#[allow]` if a later target needed the cast. --- src/sys/sysinfo.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/sys/sysinfo.rs') diff --git a/src/sys/sysinfo.rs b/src/sys/sysinfo.rs index 96f04330..e8aa00b0 100644 --- a/src/sys/sysinfo.rs +++ b/src/sys/sysinfo.rs @@ -30,6 +30,8 @@ impl SysInfo { } /// Returns the time since system boot. + // The cast is not unnecessary on all platforms. + #[allow(clippy::unnecessary_cast)] pub fn uptime(&self) -> Duration { // Truncate negative values to 0 Duration::from_secs(cmp::max(self.0.uptime, 0) as u64) @@ -64,6 +66,8 @@ impl SysInfo { self.scale_mem(self.0.freeram) } + // The cast is not unnecessary on all platforms. + #[allow(clippy::unnecessary_cast)] fn scale_mem(&self, units: mem_blocks_t) -> u64 { units as u64 * self.0.mem_unit as u64 } -- cgit v1.2.3