clippy fixes for rust 1.80

This commit is contained in:
Christien Rioux 2024-07-27 17:19:39 -04:00
parent 87a0e38e36
commit 006e7aaaf5
5 changed files with 59 additions and 53 deletions

View File

@ -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

View File

@ -77,9 +77,11 @@ pub(crate) fn capability_fanout_node_info_filter(caps: Vec<Capability>) -> 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

View File

@ -242,24 +242,24 @@ impl From<std::io::Error> 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()),

View File

@ -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<T: Send + 'static>(
&mut self,
receiver: flume::Receiver<T>,

View File

@ -28,20 +28,20 @@ impl<T> IoNetworkResultExt<T> for io::Result<T> {
fn into_network_result(self) -> io::Result<NetworkResult<T>> {
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<T> FoldedNetworkResultExt<T> for io::Result<TimeoutOr<T>> {
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<T> FoldedNetworkResultExt<T> for io::Result<NetworkResult<T>> {
fn folded(self) -> io::Result<NetworkResult<T>> {
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() {