From 006e7aaaf5488dc5bcb870ea288642cead1c7e18 Mon Sep 17 00:00:00 2001 From: Christien Rioux Date: Sat, 27 Jul 2024 17:19:39 -0400 Subject: [PATCH] clippy fixes for rust 1.80 --- veilid-core/Cargo.toml | 2 + veilid-core/src/rpc_processor/fanout_call.rs | 2 + veilid-core/src/veilid_api/error.rs | 28 +++---- veilid-tools/src/deferred_stream_processor.rs | 4 +- veilid-tools/src/network_result.rs | 76 +++++++++---------- 5 files changed, 59 insertions(+), 53 deletions(-) diff --git a/veilid-core/Cargo.toml b/veilid-core/Cargo.toml index 160cd873..ea7cbef0 100644 --- a/veilid-core/Cargo.toml +++ b/veilid-core/Cargo.toml @@ -52,6 +52,8 @@ crypto-test-none = ["enable-crypto-none"] veilid_core_android_tests = ["dep:paranoid-android"] veilid_core_ios_tests = ["dep:tracing-oslog"] debug-locks = ["veilid-tools/debug-locks"] +unstable-blockstore = [] +unstable-tunnels = [] ### DEPENDENCIES diff --git a/veilid-core/src/rpc_processor/fanout_call.rs b/veilid-core/src/rpc_processor/fanout_call.rs index 0b9bc509..16f212cf 100644 --- a/veilid-core/src/rpc_processor/fanout_call.rs +++ b/veilid-core/src/rpc_processor/fanout_call.rs @@ -77,9 +77,11 @@ pub(crate) fn capability_fanout_node_info_filter(caps: Vec) -> Fanou /// If has pluggable callbacks: /// * 'check_done' - for checking for a termination condition /// * 'call_routine' - routine to call for each node that performs an operation and may add more nodes to our closest_nodes set +/// /// The algorithm is parameterized by: /// * 'node_count' - the number of nodes to keep in the closest_nodes set /// * 'fanout' - the number of concurrent calls being processed at the same time +/// /// The algorithm returns early if 'check_done' returns some value, or if an error is found during the process. /// If the algorithm times out, a Timeout result is returned, however operations will still have been performed and a /// timeout is not necessarily indicative of an algorithmic 'failure', just that no definitive stopping condition was found diff --git a/veilid-core/src/veilid_api/error.rs b/veilid-core/src/veilid_api/error.rs index b7c801ea..cf402321 100644 --- a/veilid-core/src/veilid_api/error.rs +++ b/veilid-core/src/veilid_api/error.rs @@ -242,24 +242,24 @@ impl From for VeilidAPIError { std::io::ErrorKind::TimedOut => VeilidAPIError::timeout(), std::io::ErrorKind::ConnectionRefused => VeilidAPIError::no_connection(e.to_string()), std::io::ErrorKind::ConnectionReset => VeilidAPIError::no_connection(e.to_string()), - #[cfg(feature = "io_error_more")] - std::io::ErrorKind::HostUnreachable => VeilidAPIError::no_connection(e.to_string()), - #[cfg(feature = "io_error_more")] - std::io::ErrorKind::NetworkUnreachable => VeilidAPIError::no_connection(e.to_string()), + // #[cfg(feature = "io_error_more")] + // std::io::ErrorKind::HostUnreachable => VeilidAPIError::no_connection(e.to_string()), + // #[cfg(feature = "io_error_more")] + // std::io::ErrorKind::NetworkUnreachable => VeilidAPIError::no_connection(e.to_string()), std::io::ErrorKind::ConnectionAborted => VeilidAPIError::no_connection(e.to_string()), std::io::ErrorKind::NotConnected => VeilidAPIError::no_connection(e.to_string()), std::io::ErrorKind::AddrInUse => VeilidAPIError::no_connection(e.to_string()), std::io::ErrorKind::AddrNotAvailable => VeilidAPIError::no_connection(e.to_string()), - #[cfg(feature = "io_error_more")] - std::io::ErrorKind::NetworkDown => VeilidAPIError::no_connection(e.to_string()), - #[cfg(feature = "io_error_more")] - std::io::ErrorKind::ReadOnlyFilesystem => VeilidAPIError::internal(e.to_string()), - #[cfg(feature = "io_error_more")] - std::io::ErrorKind::NotSeekable => VeilidAPIError::internal(e.to_string()), - #[cfg(feature = "io_error_more")] - std::io::ErrorKind::FilesystemQuotaExceeded => VeilidAPIError::internal(e.to_string()), - #[cfg(feature = "io_error_more")] - std::io::ErrorKind::Deadlock => VeilidAPIError::internal(e.to_string()), + // #[cfg(feature = "io_error_more")] + // std::io::ErrorKind::NetworkDown => VeilidAPIError::no_connection(e.to_string()), + // #[cfg(feature = "io_error_more")] + // std::io::ErrorKind::ReadOnlyFilesystem => VeilidAPIError::internal(e.to_string()), + // #[cfg(feature = "io_error_more")] + // std::io::ErrorKind::NotSeekable => VeilidAPIError::internal(e.to_string()), + // #[cfg(feature = "io_error_more")] + // std::io::ErrorKind::FilesystemQuotaExceeded => VeilidAPIError::internal(e.to_string()), + // #[cfg(feature = "io_error_more")] + // std::io::ErrorKind::Deadlock => VeilidAPIError::internal(e.to_string()), std::io::ErrorKind::Unsupported => VeilidAPIError::internal(e.to_string()), std::io::ErrorKind::OutOfMemory => VeilidAPIError::internal(e.to_string()), _ => VeilidAPIError::generic(e.to_string()), diff --git a/veilid-tools/src/deferred_stream_processor.rs b/veilid-tools/src/deferred_stream_processor.rs index 13f036fe..c3745a84 100644 --- a/veilid-tools/src/deferred_stream_processor.rs +++ b/veilid-tools/src/deferred_stream_processor.rs @@ -93,9 +93,11 @@ impl DeferredStreamProcessor { } /// Queue a stream to process in the background + /// /// * 'receiver' is the stream to process /// * 'handler' is the callback to handle each item from the stream - /// Returns 'true' if the stream was added for processing, and 'false' if the stream could not be added, possibly due to not being initialized + /// + /// Returns 'true' if the stream was added for processing, and 'false' if the stream could not be added, possibly due to not being initialized. pub fn add( &mut self, receiver: flume::Receiver, diff --git a/veilid-tools/src/network_result.rs b/veilid-tools/src/network_result.rs index 0dbfed4c..faf63260 100644 --- a/veilid-tools/src/network_result.rs +++ b/veilid-tools/src/network_result.rs @@ -28,20 +28,20 @@ impl IoNetworkResultExt for io::Result { fn into_network_result(self) -> io::Result> { match self { Ok(v) => Ok(NetworkResult::Value(v)), - #[cfg(feature = "io_error_more")] - Err(e) => match e.kind() { - io::ErrorKind::TimedOut => Ok(NetworkResult::Timeout), - io::ErrorKind::UnexpectedEof - | io::ErrorKind::BrokenPipe - | io::ErrorKind::ConnectionAborted - | io::ErrorKind::ConnectionRefused - | io::ErrorKind::ConnectionReset - | io::ErrorKind::HostUnreachable - | io::ErrorKind::NetworkUnreachable => Ok(NetworkResult::NoConnection(e)), - io::ErrorKind::AddrNotAvailable => Ok(NetworkResult::AlreadyExists(e)), - _ => Err(e), - }, - #[cfg(not(feature = "io_error_more"))] + // #[cfg(feature = "io_error_more")] + // Err(e) => match e.kind() { + // io::ErrorKind::TimedOut => Ok(NetworkResult::Timeout), + // io::ErrorKind::UnexpectedEof + // | io::ErrorKind::BrokenPipe + // | io::ErrorKind::ConnectionAborted + // | io::ErrorKind::ConnectionRefused + // | io::ErrorKind::ConnectionReset + // | io::ErrorKind::HostUnreachable + // | io::ErrorKind::NetworkUnreachable => Ok(NetworkResult::NoConnection(e)), + // io::ErrorKind::AddrNotAvailable => Ok(NetworkResult::AlreadyExists(e)), + // _ => Err(e), + // }, + // #[cfg(not(feature = "io_error_more"))] Err(e) => { #[cfg(not(target_arch = "wasm32"))] if let Some(os_err) = e.raw_os_error() { @@ -91,18 +91,18 @@ impl FoldedNetworkResultExt for io::Result> { match self { Ok(TimeoutOr::Timeout) => Ok(NetworkResult::Timeout), Ok(TimeoutOr::Value(v)) => Ok(NetworkResult::Value(v)), - #[cfg(feature = "io_error_more")] - Err(e) => match e.kind() { - io::ErrorKind::TimedOut => Ok(NetworkResult::Timeout), - io::ErrorKind::ConnectionAborted - | io::ErrorKind::ConnectionRefused - | io::ErrorKind::ConnectionReset - | io::ErrorKind::HostUnreachable - | io::ErrorKind::NetworkUnreachable => Ok(NetworkResult::NoConnection(e)), - io::ErrorKind::AddrNotAvailable => Ok(NetworkResult::AlreadyExists(e)), - _ => Err(e), - }, - #[cfg(not(feature = "io_error_more"))] + // #[cfg(feature = "io_error_more")] + // Err(e) => match e.kind() { + // io::ErrorKind::TimedOut => Ok(NetworkResult::Timeout), + // io::ErrorKind::ConnectionAborted + // | io::ErrorKind::ConnectionRefused + // | io::ErrorKind::ConnectionReset + // | io::ErrorKind::HostUnreachable + // | io::ErrorKind::NetworkUnreachable => Ok(NetworkResult::NoConnection(e)), + // io::ErrorKind::AddrNotAvailable => Ok(NetworkResult::AlreadyExists(e)), + // _ => Err(e), + // }, + // #[cfg(not(feature = "io_error_more"))] Err(e) => { #[cfg(not(target_arch = "wasm32"))] if let Some(os_err) = e.raw_os_error() { @@ -127,18 +127,18 @@ impl FoldedNetworkResultExt for io::Result> { fn folded(self) -> io::Result> { match self { Ok(v) => Ok(v), - #[cfg(feature = "io_error_more")] - Err(e) => match e.kind() { - io::ErrorKind::TimedOut => Ok(NetworkResult::Timeout), - io::ErrorKind::ConnectionAborted - | io::ErrorKind::ConnectionRefused - | io::ErrorKind::ConnectionReset - | io::ErrorKind::HostUnreachable - | io::ErrorKind::NetworkUnreachable => Ok(NetworkResult::NoConnection(e)), - io::ErrorKind::AddrNotAvailable => Ok(NetworkResult::AlreadyExists(e)), - _ => Err(e), - }, - #[cfg(not(feature = "io_error_more"))] + // #[cfg(feature = "io_error_more")] + // Err(e) => match e.kind() { + // io::ErrorKind::TimedOut => Ok(NetworkResult::Timeout), + // io::ErrorKind::ConnectionAborted + // | io::ErrorKind::ConnectionRefused + // | io::ErrorKind::ConnectionReset + // | io::ErrorKind::HostUnreachable + // | io::ErrorKind::NetworkUnreachable => Ok(NetworkResult::NoConnection(e)), + // io::ErrorKind::AddrNotAvailable => Ok(NetworkResult::AlreadyExists(e)), + // _ => Err(e), + // }, + // #[cfg(not(feature = "io_error_more"))] Err(e) => { #[cfg(not(target_arch = "wasm32"))] if let Some(os_err) = e.raw_os_error() {