From 9abc6b9b7b53962e9b77957e8e5cab993d3125c4 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Thu, 11 Jan 2024 23:20:19 +0100 Subject: [PATCH] clippy stop being so mean to me pleaaseedekdseu;}yudc})vr)f --- crates/teloxide/src/update_listeners.rs | 6 +++--- crates/teloxide/src/update_listeners/polling.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/teloxide/src/update_listeners.rs b/crates/teloxide/src/update_listeners.rs index 66ca97d4..de2c4228 100644 --- a/crates/teloxide/src/update_listeners.rs +++ b/crates/teloxide/src/update_listeners.rs @@ -44,6 +44,8 @@ mod polling; #[allow(deprecated)] pub use self::polling::{polling, polling_default, Polling, PollingBuilder, PollingStream}; +type BoxFut<'a, T> = Pin + Send + 'a>>; + /// An update listener. /// /// Implementors of this trait allow getting updates from Telegram. See @@ -73,9 +75,7 @@ pub trait UpdateListener { /// should call `set_webhook`. /// /// [`Stream`]: AsUpdateStream::Stream - fn listen( - &mut self, - ) -> Pin, Self::SetupErr>> + Send + '_>>; + fn listen(&mut self) -> BoxFut<'_, Result, Self::SetupErr>>; /// Hint which updates should the listener listen for. /// diff --git a/crates/teloxide/src/update_listeners/polling.rs b/crates/teloxide/src/update_listeners/polling.rs index 2cea9bd1..8686fe5e 100644 --- a/crates/teloxide/src/update_listeners/polling.rs +++ b/crates/teloxide/src/update_listeners/polling.rs @@ -447,9 +447,9 @@ fn polling_is_send() { assert_send(&polling.listen()); assert_send(&polling.stop_token()); - _ = async { + drop(async { assert_send(&polling.listen().await.unwrap()); - }; + }); fn assert_send(_: &impl Send) {} }