Skip to content

Commit cb8b4c0

Browse files
asomersrtzoeller
authored andcommitted
Clippy cleanup for latest nightly
1 parent 9f3dd81 commit cb8b4c0

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

src/sys/time.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub(crate) mod timer {
7676

7777
/// An enumeration allowing the definition of the expiration time of an alarm,
7878
/// recurring or not.
79-
#[derive(Debug, Clone, Copy, PartialEq)]
79+
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
8080
pub enum Expiration {
8181
/// Alarm will trigger once after the time given in `TimeSpec`
8282
OneShot(TimeSpec),
@@ -243,7 +243,7 @@ impl PartialOrd for TimeSpec {
243243
impl TimeValLike for TimeSpec {
244244
#[inline]
245245
fn seconds(seconds: i64) -> TimeSpec {
246-
assert!(seconds >= TS_MIN_SECONDS && seconds <= TS_MAX_SECONDS,
246+
assert!((TS_MIN_SECONDS..=TS_MAX_SECONDS).contains(&seconds),
247247
"TimeSpec out of bounds; seconds={}", seconds);
248248
#[cfg_attr(target_env = "musl", allow(deprecated))] // https://github.com/rust-lang/libc/issues/1848
249249
TimeSpec(timespec {tv_sec: seconds as time_t, tv_nsec: 0 })
@@ -270,7 +270,7 @@ impl TimeValLike for TimeSpec {
270270
#[inline]
271271
fn nanoseconds(nanoseconds: i64) -> TimeSpec {
272272
let (secs, nanos) = div_mod_floor_64(nanoseconds, NANOS_PER_SEC);
273-
assert!(secs >= TS_MIN_SECONDS && secs <= TS_MAX_SECONDS,
273+
assert!((TS_MIN_SECONDS..=TS_MAX_SECONDS).contains(&secs),
274274
"TimeSpec out of bounds");
275275
#[cfg_attr(target_env = "musl", allow(deprecated))] // https://github.com/rust-lang/libc/issues/1848
276276
TimeSpec(timespec {tv_sec: secs as time_t,
@@ -456,7 +456,7 @@ impl PartialOrd for TimeVal {
456456
impl TimeValLike for TimeVal {
457457
#[inline]
458458
fn seconds(seconds: i64) -> TimeVal {
459-
assert!(seconds >= TV_MIN_SECONDS && seconds <= TV_MAX_SECONDS,
459+
assert!((TV_MIN_SECONDS..=TV_MAX_SECONDS).contains(&seconds),
460460
"TimeVal out of bounds; seconds={}", seconds);
461461
#[cfg_attr(target_env = "musl", allow(deprecated))] // https://github.com/rust-lang/libc/issues/1848
462462
TimeVal(timeval {tv_sec: seconds as time_t, tv_usec: 0 })
@@ -474,7 +474,7 @@ impl TimeValLike for TimeVal {
474474
#[inline]
475475
fn microseconds(microseconds: i64) -> TimeVal {
476476
let (secs, micros) = div_mod_floor_64(microseconds, MICROS_PER_SEC);
477-
assert!(secs >= TV_MIN_SECONDS && secs <= TV_MAX_SECONDS,
477+
assert!((TV_MIN_SECONDS..=TV_MAX_SECONDS).contains(&secs),
478478
"TimeVal out of bounds");
479479
#[cfg_attr(target_env = "musl", allow(deprecated))] // https://github.com/rust-lang/libc/issues/1848
480480
TimeVal(timeval {tv_sec: secs as time_t,
@@ -487,7 +487,7 @@ impl TimeValLike for TimeVal {
487487
fn nanoseconds(nanoseconds: i64) -> TimeVal {
488488
let microseconds = nanoseconds / 1000;
489489
let (secs, micros) = div_mod_floor_64(microseconds, MICROS_PER_SEC);
490-
assert!(secs >= TV_MIN_SECONDS && secs <= TV_MAX_SECONDS,
490+
assert!((TV_MIN_SECONDS..=TV_MAX_SECONDS).contains(&secs),
491491
"TimeVal out of bounds");
492492
#[cfg_attr(target_env = "musl", allow(deprecated))] // https://github.com/rust-lang/libc/issues/1848
493493
TimeVal(timeval {tv_sec: secs as time_t,

src/sys/uio.rs

+4
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ pub struct RemoteIoVec {
132132
note = "`IoVec` is no longer used in the public interface, use `IoSlice` or `IoSliceMut` instead"
133133
)]
134134
#[repr(transparent)]
135+
#[allow(renamed_and_removed_lints)]
136+
#[allow(clippy::unknown_clippy_lints)]
137+
// Clippy false positive: https://github.com/rust-lang/rust-clippy/issues/8867
138+
#[allow(clippy::derive_partial_eq_without_eq)]
135139
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
136140
pub struct IoVec<T>(pub(crate) libc::iovec, PhantomData<T>);
137141

src/unistd.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2855,7 +2855,7 @@ feature! {
28552855
/// guaranteed to conform to [`NAME_REGEX`](https://serverfault.com/a/73101/407341), which only
28562856
/// contains ASCII.
28572857
#[cfg(not(target_os = "redox"))] // RedoxFS does not support passwd
2858-
#[derive(Debug, Clone, PartialEq)]
2858+
#[derive(Debug, Clone, Eq, PartialEq)]
28592859
pub struct User {
28602860
/// Username
28612861
pub name: String,
@@ -3065,7 +3065,7 @@ impl User {
30653065

30663066
/// Representation of a Group, based on `libc::group`
30673067
#[cfg(not(target_os = "redox"))] // RedoxFS does not support passwd
3068-
#[derive(Debug, Clone, PartialEq)]
3068+
#[derive(Debug, Clone, Eq, PartialEq)]
30693069
pub struct Group {
30703070
/// Group name
30713071
pub name: String,

0 commit comments

Comments
 (0)