summaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/time.rs12
-rw-r--r--src/sys/uio.rs4
2 files changed, 10 insertions, 6 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<T>(pub(crate) libc::iovec, PhantomData<T>);