more clippy
This commit is contained in:
@@ -177,10 +177,10 @@ impl PrivateRoute {
|
||||
None => PrivateRouteHops::Empty,
|
||||
};
|
||||
|
||||
return Some(first_hop_node);
|
||||
Some(first_hop_node)
|
||||
}
|
||||
PrivateRouteHops::Data(_) => return None,
|
||||
PrivateRouteHops::Empty => return None,
|
||||
PrivateRouteHops::Data(_) => None,
|
||||
PrivateRouteHops::Empty => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -278,7 +278,7 @@ fn first_filtered_dial_info_detail_between_nodes(
|
||||
sequencing: Sequencing,
|
||||
dif_sort: Option<Arc<DialInfoDetailSort>>
|
||||
) -> Option<DialInfoDetail> {
|
||||
let dial_info_filter = dial_info_filter.clone().filtered(
|
||||
let dial_info_filter = (*dial_info_filter).filtered(
|
||||
&DialInfoFilter::all()
|
||||
.with_address_type_set(from_node.address_types())
|
||||
.with_protocol_type_set(from_node.outbound_protocols()),
|
||||
@@ -416,7 +416,6 @@ impl RoutingDomainDetail for PublicInternetRoutingDomainDetail {
|
||||
|
||||
// Does node B have a direct udp dialinfo node A can reach?
|
||||
let udp_dial_info_filter = dial_info_filter
|
||||
.clone()
|
||||
.filtered(&DialInfoFilter::all().with_protocol_type(ProtocolType::UDP));
|
||||
if let Some(target_udp_did) = first_filtered_dial_info_detail_between_nodes(
|
||||
node_a,
|
||||
@@ -471,7 +470,7 @@ impl RoutingDomainDetail for PublicInternetRoutingDomainDetail {
|
||||
// Can we reach the inbound relay?
|
||||
if first_filtered_dial_info_detail_between_nodes(
|
||||
node_a,
|
||||
&node_b_relay,
|
||||
node_b_relay,
|
||||
&dial_info_filter,
|
||||
sequencing,
|
||||
dif_sort.clone()
|
||||
|
@@ -543,7 +543,7 @@ impl RoutingTableInner {
|
||||
// Collect all entries that are 'needs_ping' and have some node info making them reachable somehow
|
||||
let mut node_refs = Vec::<NodeRef>::with_capacity(self.bucket_entry_count());
|
||||
self.with_entries(cur_ts, BucketEntryState::Unreliable, |rti, entry| {
|
||||
if entry.with_inner(|e| {
|
||||
let entry_needs_ping = |e: &BucketEntryInner| {
|
||||
// If this entry isn't in the routing domain we are checking, don't include it
|
||||
if !e.exists_in_routing_domain(rti, routing_domain) {
|
||||
return false;
|
||||
@@ -566,7 +566,9 @@ impl RoutingTableInner {
|
||||
}
|
||||
|
||||
false
|
||||
}) {
|
||||
};
|
||||
|
||||
if entry.with_inner(entry_needs_ping) {
|
||||
node_refs.push(NodeRef::new(
|
||||
outer_self.clone(),
|
||||
entry,
|
||||
@@ -982,7 +984,7 @@ impl RoutingTableInner {
|
||||
match entry {
|
||||
None => has_valid_own_node_info,
|
||||
Some(entry) => entry.with_inner(|e| {
|
||||
e.signed_node_info(routing_domain.into())
|
||||
e.signed_node_info(routing_domain)
|
||||
.map(|sni| sni.has_any_signature())
|
||||
.unwrap_or(false)
|
||||
}),
|
||||
@@ -1079,11 +1081,7 @@ impl RoutingTableInner {
|
||||
move |_rti: &RoutingTableInner, v: Option<Arc<BucketEntry>>| {
|
||||
if let Some(entry) = &v {
|
||||
// always filter out dead nodes
|
||||
if entry.with_inner(|e| e.state(cur_ts) == BucketEntryState::Dead) {
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
!entry.with_inner(|e| e.state(cur_ts) == BucketEntryState::Dead)
|
||||
} else {
|
||||
// always filter out self peer, as it is irrelevant to the 'fastest nodes' search
|
||||
false
|
||||
@@ -1099,7 +1097,7 @@ impl RoutingTableInner {
|
||||
// same nodes are always the same
|
||||
if let Some(a_entry) = a_entry {
|
||||
if let Some(b_entry) = b_entry {
|
||||
if Arc::ptr_eq(&a_entry, &b_entry) {
|
||||
if Arc::ptr_eq(a_entry, b_entry) {
|
||||
return core::cmp::Ordering::Equal;
|
||||
}
|
||||
}
|
||||
@@ -1150,9 +1148,7 @@ impl RoutingTableInner {
|
||||
})
|
||||
};
|
||||
|
||||
let out =
|
||||
self.find_peers_with_sort_and_filter(node_count, cur_ts, filters, sort, transform);
|
||||
out
|
||||
self.find_peers_with_sort_and_filter(node_count, cur_ts, filters, sort, transform)
|
||||
}
|
||||
|
||||
pub fn find_preferred_closest_nodes<T, O>(
|
||||
@@ -1193,7 +1189,7 @@ impl RoutingTableInner {
|
||||
// same nodes are always the same
|
||||
if let Some(a_entry) = a_entry {
|
||||
if let Some(b_entry) = b_entry {
|
||||
if Arc::ptr_eq(&a_entry, &b_entry) {
|
||||
if Arc::ptr_eq(a_entry, b_entry) {
|
||||
return core::cmp::Ordering::Equal;
|
||||
}
|
||||
}
|
||||
|
@@ -30,8 +30,8 @@ pub async fn test_routingtable_buckets_round_trip() {
|
||||
|
||||
for crypto in routing_table_keys {
|
||||
// The same keys are present in the original and copy RoutingTables.
|
||||
let original_buckets = original_inner.buckets.get(&crypto).unwrap();
|
||||
let copy_buckets = copy_inner.buckets.get(&crypto).unwrap();
|
||||
let original_buckets = original_inner.buckets.get(crypto).unwrap();
|
||||
let copy_buckets = copy_inner.buckets.get(crypto).unwrap();
|
||||
|
||||
// Recurse into RoutingTable.inner.buckets
|
||||
for (left_buckets, right_buckets) in original_buckets.iter().zip(copy_buckets.iter()) {
|
||||
|
Reference in New Issue
Block a user