Skip to content

Commit a8d1194

Browse files
author
dcz
committed
clippy: Fix abs_diff warning
1 parent f14fd62 commit a8d1194

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/utils/serial.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@ impl Eq for Serial {}
2222
impl PartialOrd for Serial {
2323
#[inline]
2424
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
25-
let distance = if self.0 > other.0 {
26-
self.0 - other.0
27-
} else {
28-
other.0 - self.0
29-
};
25+
let distance = self.0.abs_diff(other.0);
3026
if distance < u32::MAX / 2 {
3127
self.0.partial_cmp(&other.0)
3228
} else {

0 commit comments

Comments
 (0)