Skip to content

Commit

Permalink
chore: use futures_utill::ready
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto committed Sep 15, 2023
1 parent 229757e commit 2fa221a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/client/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -689,7 +689,7 @@ impl<T: Poolable, K: Key> Future for Checkout<T, K> {
type Output = Result<Pooled<T, K>, Error>;

fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
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));
}

Expand Down Expand Up @@ -791,7 +791,7 @@ impl<T: Poolable + 'static, K: Key> Future for IdleTask<T, K> {
}
}

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() {
Expand Down
10 changes: 0 additions & 10 deletions src/common/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 2fa221a

Please sign in to comment.