File tree Expand file tree Collapse file tree 2 files changed +3
-11
lines changed
iroh/src/magicsock/node_map Expand file tree Collapse file tree 2 files changed +3
-11
lines changed Original file line number Diff line number Diff line change @@ -68,10 +68,7 @@ impl PathValidity {
68
68
}
69
69
70
70
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 ( ) ?;
75
72
state. is_valid ( now) . then_some ( state. recent_pong . latency )
76
73
}
77
74
@@ -87,10 +84,7 @@ impl PathValidity {
87
84
}
88
85
89
86
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 ( ) ?;
94
88
state. is_outdated ( now) . then_some ( state. recent_pong . latency )
95
89
}
96
90
Original file line number Diff line number Diff line change @@ -164,8 +164,6 @@ impl<N: PartialOrd + Ord + PartialEq + Eq> Ord for ReverseOrd<N> {
164
164
165
165
impl < N : PartialOrd + Ord + PartialEq + Eq > PartialOrd for ReverseOrd < N > {
166
166
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) )
170
168
}
171
169
}
You can’t perform that action at this time.
0 commit comments