From b9541a1f73f098dc26999478110e290b2acda2c3 Mon Sep 17 00:00:00 2001 From: AH-dark Date: Sun, 7 Apr 2024 21:26:36 +0800 Subject: [PATCH] style: use variable --- rust-common/Cargo.toml | 2 +- rust-common/src/bot/channel.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/rust-common/Cargo.toml b/rust-common/Cargo.toml index c098605..0ee2d97 100644 --- a/rust-common/Cargo.toml +++ b/rust-common/Cargo.toml @@ -22,7 +22,7 @@ teloxide = { workspace = true } redis = { workspace = true } lapin = { workspace = true } log = { workspace = true } -futures = { version = "0.3", features = [] } +futures = { version = "0.3", features = ["default"] } serde_json = { version = "1.0.114", features = [] } async-stream = "0.3.5" reqwest = "0.12" diff --git a/rust-common/src/bot/channel.rs b/rust-common/src/bot/channel.rs index e0684d0..f580ec0 100644 --- a/rust-common/src/bot/channel.rs +++ b/rust-common/src/bot/channel.rs @@ -26,7 +26,9 @@ impl<'a> AsUpdateStream<'a> for MqUpdateListener { fn as_stream(&'a mut self) -> Self::Stream { let flag = self.flag.clone(); - Box::pin(self.consumer.clone().filter_map(move |delivery| { + let consumer = self.consumer.clone(); + + Box::pin(consumer.filter_map(move |delivery| { assert!(!flag.is_stopped(), "Update listener stopped"); if self.consumer.state() != lapin::ConsumerState::Active && self.consumer.state() != lapin::ConsumerState::ActiveWithDelegate @@ -56,8 +58,7 @@ impl<'a> AsUpdateStream<'a> for MqUpdateListener { None } } - } - .boxed() + }.boxed() })) } }