Skip to content

Commit a3d6754

Browse files
committed
Clippy fixes and format
1 parent 497740a commit a3d6754

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

iroh/src/magicsock/node_map/path_validity.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,7 @@ impl PathValidity {
6868
}
6969

7070
pub(super) fn latency_if_valid(&self, now: Instant) -> Option<Duration> {
71-
let Some(state) = self.0.as_ref() else {
72-
return None;
73-
};
74-
71+
let state = self.0.as_ref()?;
7572
state.is_valid(now).then_some(state.recent_pong.latency)
7673
}
7774

@@ -87,10 +84,7 @@ impl PathValidity {
8784
}
8885

8986
pub(super) fn latency_if_outdated(&self, now: Instant) -> Option<Duration> {
90-
let Some(state) = self.0.as_ref() else {
91-
return None;
92-
};
93-
87+
let state = self.0.as_ref()?;
9488
state.is_outdated(now).then_some(state.recent_pong.latency)
9589
}
9690

iroh/src/magicsock/node_map/udp_paths.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,6 @@ impl<N: PartialOrd + Ord + PartialEq + Eq> Ord for ReverseOrd<N> {
164164

165165
impl<N: PartialOrd + Ord + PartialEq + Eq> PartialOrd for ReverseOrd<N> {
166166
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
167-
self.0
168-
.partial_cmp(&other.0)
169-
.map(std::cmp::Ordering::reverse)
167+
Some(self.cmp(other))
170168
}
171169
}

0 commit comments

Comments
 (0)