Skip to content

Commit

Permalink
Merge pull request 'clippy fix' (#37) from clippy-fix into main
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed Oct 10, 2023
2 parents 57c1d03 + 8cbfef4 commit 016e0d8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl PartialEq for PacketId {

impl PartialOrd for PacketId {
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
self.raw().partial_cmp(&other.raw())
Some(self.cmp(other))
}
}

Expand Down
28 changes: 14 additions & 14 deletions src/time/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,18 @@ impl From<DateTime<Utc>> for UnixTimestamp {

impl PartialOrd for UnixTimestamp {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}

impl Ord for UnixTimestamp {
fn cmp(&self, other: &Self) -> Ordering {
if self == other {
return Some(Ordering::Equal);
return Ordering::Equal;
}
match self.unix_seconds.cmp(&other.unix_seconds) {
Ordering::Less => return Some(Ordering::Less),
Ordering::Greater => return Some(Ordering::Greater),
Ordering::Less => return Ordering::Less,
Ordering::Greater => return Ordering::Greater,
_ => (),
}

Expand All @@ -323,27 +329,21 @@ impl PartialOrd for UnixTimestamp {
{
Ordering::Less => {
return if self.unix_seconds < 0 {
Some(Ordering::Greater)
Ordering::Greater
} else {
Some(Ordering::Less)
Ordering::Less
}
}
Ordering::Greater => {
return if self.unix_seconds < 0 {
Some(Ordering::Less)
Ordering::Less
} else {
Some(Ordering::Greater)
Ordering::Greater
}
}
Ordering::Equal => (),
}
Some(Ordering::Equal)
}
}

impl Ord for UnixTimestamp {
fn cmp(&self, other: &Self) -> Ordering {
PartialOrd::partial_cmp(self, other).unwrap()
Ordering::Equal
}
}

Expand Down

0 comments on commit 016e0d8

Please sign in to comment.