From aab09ede6c86fb84544533dd7d011fc630acdc28 Mon Sep 17 00:00:00 2001 From: Yosh Date: Wed, 20 Mar 2024 23:33:09 +0100 Subject: [PATCH] apply clippy fixes --- examples/happy_eyeballs.rs | 2 +- src/concurrent_stream/for_each.rs | 4 ++-- src/future/join/tuple.rs | 2 +- src/future/try_join/tuple.rs | 2 +- src/utils/private.rs | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/happy_eyeballs.rs b/examples/happy_eyeballs.rs index ed591cd..63da6ce 100644 --- a/examples/happy_eyeballs.rs +++ b/examples/happy_eyeballs.rs @@ -44,5 +44,5 @@ async fn open_tcp_socket( } // Start connecting. If an attempt succeeds, cancel all others attempts. - Ok(futures.race_ok().await?) + futures.race_ok().await } diff --git a/src/concurrent_stream/for_each.rs b/src/concurrent_stream/for_each.rs index 89d1ea6..a9b6dc7 100644 --- a/src/concurrent_stream/for_each.rs +++ b/src/concurrent_stream/for_each.rs @@ -76,7 +76,7 @@ where async fn progress(self: Pin<&mut Self>) -> super::ConsumerState { let mut this = self.project(); - while let Some(_) = this.group.next().await {} + while (this.group.next().await).is_some() {} ConsumerState::Empty } @@ -85,7 +85,7 @@ where // 4. We will no longer receive any additional futures from the // underlying stream; wait until all the futures in the group have // resolved. - while let Some(_) = this.group.next().await {} + while (this.group.next().await).is_some() {} } } diff --git a/src/future/join/tuple.rs b/src/future/join/tuple.rs index b797494..0d01995 100644 --- a/src/future/join/tuple.rs +++ b/src/future/join/tuple.rs @@ -338,7 +338,7 @@ mod test { use futures_lite::future::pending; thread_local! { - static NOT_LEAKING: RefCell = RefCell::new(false); + static NOT_LEAKING: RefCell = const { RefCell::new(false) }; }; struct FlipFlagAtDrop; diff --git a/src/future/try_join/tuple.rs b/src/future/try_join/tuple.rs index 8094b48..8cf1152 100644 --- a/src/future/try_join/tuple.rs +++ b/src/future/try_join/tuple.rs @@ -382,7 +382,7 @@ mod test { use futures_lite::future::pending; thread_local! { - static NOT_LEAKING: RefCell = RefCell::new(false); + static NOT_LEAKING: RefCell = const { RefCell::new(false) }; }; struct FlipFlagAtDrop; diff --git a/src/utils/private.rs b/src/utils/private.rs index 3dbb42e..b0fb1e6 100644 --- a/src/utils/private.rs +++ b/src/utils/private.rs @@ -161,8 +161,8 @@ pub struct PrivateMarker; #[macro_export] macro_rules! private_impl { () => { - fn __futures_concurrency_private__(&self) -> crate::private::PrivateMarker { - crate::private::PrivateMarker + fn __futures_concurrency_private__(&self) -> $crate::private::PrivateMarker { + $crate::private::PrivateMarker } }; } @@ -174,6 +174,6 @@ macro_rules! private_decl { /// This trait is private; this method exists to make it /// impossible to implement outside the crate. #[doc(hidden)] - fn __futures_concurrency_private__(&self) -> crate::private::PrivateMarker; + fn __futures_concurrency_private__(&self) -> $crate::private::PrivateMarker; }; }