From 6f1c748938cd7e87a52756dcbfc90e8d1c6c2848 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sun, 29 May 2022 14:00:48 -0600 Subject: Clippy cleanup for latest nightly --- src/sys/time.rs | 12 ++++++------ src/sys/uio.rs | 4 ++++ src/unistd.rs | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/sys/time.rs b/src/sys/time.rs index 1e62b76a..c29259b2 100644 --- a/src/sys/time.rs +++ b/src/sys/time.rs @@ -76,7 +76,7 @@ pub(crate) mod timer { /// An enumeration allowing the definition of the expiration time of an alarm, /// recurring or not. - #[derive(Debug, Clone, Copy, PartialEq)] + #[derive(Debug, Clone, Copy, Eq, PartialEq)] pub enum Expiration { /// Alarm will trigger once after the time given in `TimeSpec` OneShot(TimeSpec), @@ -243,7 +243,7 @@ impl PartialOrd for TimeSpec { impl TimeValLike for TimeSpec { #[inline] fn seconds(seconds: i64) -> TimeSpec { - assert!(seconds >= TS_MIN_SECONDS && seconds <= TS_MAX_SECONDS, + assert!((TS_MIN_SECONDS..=TS_MAX_SECONDS).contains(&seconds), "TimeSpec out of bounds; seconds={}", seconds); #[cfg_attr(target_env = "musl", allow(deprecated))] // https://github.com/rust-lang/libc/issues/1848 TimeSpec(timespec {tv_sec: seconds as time_t, tv_nsec: 0 }) @@ -270,7 +270,7 @@ impl TimeValLike for TimeSpec { #[inline] fn nanoseconds(nanoseconds: i64) -> TimeSpec { let (secs, nanos) = div_mod_floor_64(nanoseconds, NANOS_PER_SEC); - assert!(secs >= TS_MIN_SECONDS && secs <= TS_MAX_SECONDS, + assert!((TS_MIN_SECONDS..=TS_MAX_SECONDS).contains(&secs), "TimeSpec out of bounds"); #[cfg_attr(target_env = "musl", allow(deprecated))] // https://github.com/rust-lang/libc/issues/1848 TimeSpec(timespec {tv_sec: secs as time_t, @@ -456,7 +456,7 @@ impl PartialOrd for TimeVal { impl TimeValLike for TimeVal { #[inline] fn seconds(seconds: i64) -> TimeVal { - assert!(seconds >= TV_MIN_SECONDS && seconds <= TV_MAX_SECONDS, + assert!((TV_MIN_SECONDS..=TV_MAX_SECONDS).contains(&seconds), "TimeVal out of bounds; seconds={}", seconds); #[cfg_attr(target_env = "musl", allow(deprecated))] // https://github.com/rust-lang/libc/issues/1848 TimeVal(timeval {tv_sec: seconds as time_t, tv_usec: 0 }) @@ -474,7 +474,7 @@ impl TimeValLike for TimeVal { #[inline] fn microseconds(microseconds: i64) -> TimeVal { let (secs, micros) = div_mod_floor_64(microseconds, MICROS_PER_SEC); - assert!(secs >= TV_MIN_SECONDS && secs <= TV_MAX_SECONDS, + assert!((TV_MIN_SECONDS..=TV_MAX_SECONDS).contains(&secs), "TimeVal out of bounds"); #[cfg_attr(target_env = "musl", allow(deprecated))] // https://github.com/rust-lang/libc/issues/1848 TimeVal(timeval {tv_sec: secs as time_t, @@ -487,7 +487,7 @@ impl TimeValLike for TimeVal { fn nanoseconds(nanoseconds: i64) -> TimeVal { let microseconds = nanoseconds / 1000; let (secs, micros) = div_mod_floor_64(microseconds, MICROS_PER_SEC); - assert!(secs >= TV_MIN_SECONDS && secs <= TV_MAX_SECONDS, + assert!((TV_MIN_SECONDS..=TV_MAX_SECONDS).contains(&secs), "TimeVal out of bounds"); #[cfg_attr(target_env = "musl", allow(deprecated))] // https://github.com/rust-lang/libc/issues/1848 TimeVal(timeval {tv_sec: secs as time_t, diff --git a/src/sys/uio.rs b/src/sys/uio.rs index 4b3851f5..1908973b 100644 --- a/src/sys/uio.rs +++ b/src/sys/uio.rs @@ -132,6 +132,10 @@ pub struct RemoteIoVec { note = "`IoVec` is no longer used in the public interface, use `IoSlice` or `IoSliceMut` instead" )] #[repr(transparent)] +#[allow(renamed_and_removed_lints)] +#[allow(clippy::unknown_clippy_lints)] +// Clippy false positive: https://github.com/rust-lang/rust-clippy/issues/8867 +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub struct IoVec(pub(crate) libc::iovec, PhantomData); diff --git a/src/unistd.rs b/src/unistd.rs index 8c42fd2b..142aae79 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -2857,7 +2857,7 @@ feature! { /// guaranteed to conform to [`NAME_REGEX`](https://serverfault.com/a/73101/407341), which only /// contains ASCII. #[cfg(not(target_os = "redox"))] // RedoxFS does not support passwd -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct User { /// Username pub name: String, @@ -3076,7 +3076,7 @@ impl User { /// Representation of a Group, based on `libc::group` #[cfg(not(target_os = "redox"))] // RedoxFS does not support passwd -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct Group { /// Group name pub name: String, -- cgit v1.2.3