From 4a4271db616caf0b937a5d8dd3f5ccac899a268d Mon Sep 17 00:00:00 2001 From: Christien Rioux Date: Fri, 29 Mar 2024 21:12:36 -0400 Subject: [PATCH] clippy fixes and cleanup --- veilid-core/src/network_manager/connection_manager.rs | 10 +++------- .../src/network_manager/native/discovery_context.rs | 7 ++----- veilid-core/src/veilid_api/debug.rs | 5 +---- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/veilid-core/src/network_manager/connection_manager.rs b/veilid-core/src/network_manager/connection_manager.rs index f487b786..d19264d1 100644 --- a/veilid-core/src/network_manager/connection_manager.rs +++ b/veilid-core/src/network_manager/connection_manager.rs @@ -166,13 +166,9 @@ impl ConnectionManager { let netman = self.network_manager(); let routing_table = netman.routing_table(); let remote_address = conn.flow().remote_address().address(); - let Some(routing_domain) = routing_table.routing_domain_for_address(remote_address) else { - return None; - }; - let Some(rn) = routing_table.relay_node(routing_domain) else { - return None; - }; - let relay_nr = rn.filtered_clone( + let routing_domain = routing_table.routing_domain_for_address(remote_address)?; + let relay_node = routing_table.relay_node(routing_domain)?; + let relay_nr = relay_node.filtered_clone( NodeRefFilter::new() .with_routing_domain(routing_domain) .with_address_type(conn.flow().address_type()) diff --git a/veilid-core/src/network_manager/native/discovery_context.rs b/veilid-core/src/network_manager/native/discovery_context.rs index 728022ae..c1b05c8b 100644 --- a/veilid-core/src/network_manager/native/discovery_context.rs +++ b/veilid-core/src/network_manager/native/discovery_context.rs @@ -340,17 +340,14 @@ impl DiscoveryContext { tries += 1; // Attempt a port mapping. If this doesn't succeed, it's not going to - let Some(mapped_external_address) = igd_manager + let mapped_external_address = igd_manager .map_any_port( low_level_protocol_type, address_type, local_port, Some(external_1.address.ip_addr()), ) - .await - else { - return None; - }; + .await?; // Make dial info from the port mapping let external_mapped_dial_info = self.unlocked_inner.net.make_dial_info( diff --git a/veilid-core/src/veilid_api/debug.rs b/veilid-core/src/veilid_api/debug.rs index 7596bcc4..ddd7b6cc 100644 --- a/veilid-core/src/veilid_api/debug.rs +++ b/veilid-core/src/veilid_api/debug.rs @@ -239,10 +239,7 @@ fn get_destination( let private_route = if let Some(prid) = get_route_id(rss.clone(), false, true)(text) { - let Some(private_route) = rss.best_remote_private_route(&prid) else { - return None; - }; - private_route + rss.best_remote_private_route(&prid)? } else { let mut dc = DEBUG_CACHE.lock(); let n = get_number(text)?;