From 2fa221accf4dd2e5d7e0569f041243e350bdb82e Mon Sep 17 00:00:00 2001 From: tottoto Date: Fri, 15 Sep 2023 20:51:10 +0900 Subject: [PATCH] chore: use futures_utill::ready --- src/client/pool.rs | 6 +++--- src/common/mod.rs | 10 ---------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/client/pool.rs b/src/client/pool.rs index 2082550..434123b 100644 --- a/src/client/pool.rs +++ b/src/client/pool.rs @@ -19,7 +19,7 @@ use tokio::time::{Duration, Instant, Interval}; use futures_channel::oneshot; use tracing::{debug, trace}; -use crate::common::{exec::Exec, ready}; +use crate::common::exec::Exec; // FIXME: allow() required due to `impl Trait` leaking types to this lint #[allow(missing_debug_implementations)] @@ -689,7 +689,7 @@ impl Future for Checkout { type Output = Result, Error>; fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll { - if let Some(pooled) = ready!(self.poll_waiter(cx)?) { + if let Some(pooled) = futures_util::ready!(self.poll_waiter(cx)?) { return Poll::Ready(Ok(pooled)); } @@ -791,7 +791,7 @@ impl Future for IdleTask { } } - ready!(this.interval.as_mut().poll_tick(cx)); + futures_util::ready!(this.interval.as_mut().poll_tick(cx)); if let Some(inner) = this.pool.upgrade() { if let Ok(mut inner) = inner.lock() { diff --git a/src/common/mod.rs b/src/common/mod.rs index 6eeabaf..faf2162 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -1,15 +1,5 @@ #![allow(missing_docs)] -macro_rules! ready { - ($e:expr) => { - match $e { - std::task::Poll::Ready(v) => v, - std::task::Poll::Pending => return std::task::Poll::Pending, - } - }; -} - -pub(crate) use ready; pub mod exec; #[cfg(feature = "client")] mod lazy;