Skip to content

Commit 13b8960

Browse files
Replace stabilized futures-util APIs with std
1 parent 76953bc commit 13b8960

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,15 +324,15 @@ pub trait AsyncConnection: SimpleAsyncConnection + Sized + Send {
324324
.map_err(|_| diesel::result::Error::RollbackTransaction)
325325
.and_then(move |r| {
326326
let _ = user_result_tx.send(r);
327-
futures_util::future::ready(Err(diesel::result::Error::RollbackTransaction))
327+
std::future::ready(Err(diesel::result::Error::RollbackTransaction))
328328
})
329329
.scope_boxed()
330330
})
331331
.then(move |_r| {
332332
let r = user_result_rx
333333
.try_recv()
334334
.expect("Transaction did not succeed");
335-
futures_util::future::ready(r)
335+
std::future::ready(r)
336336
})
337337
}
338338

src/run_query_dsl/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ pub trait RunQueryDsl<Conn>: Sized {
399399
/// .await?
400400
/// .try_fold(Vec::new(), |mut acc, item| {
401401
/// acc.push(item);
402-
/// futures_util::future::ready(Ok(acc))
402+
/// std::future::ready(Ok(acc))
403403
/// })
404404
/// .await?;
405405
/// assert_eq!(vec!["Sean", "Tess"], data);
@@ -428,7 +428,7 @@ pub trait RunQueryDsl<Conn>: Sized {
428428
/// .await?
429429
/// .try_fold(Vec::new(), |mut acc, item| {
430430
/// acc.push(item);
431-
/// futures_util::future::ready(Ok(acc))
431+
/// std::future::ready(Ok(acc))
432432
/// })
433433
/// .await?;
434434
/// let expected_data = vec![
@@ -468,7 +468,7 @@ pub trait RunQueryDsl<Conn>: Sized {
468468
/// .await?
469469
/// .try_fold(Vec::new(), |mut acc, item| {
470470
/// acc.push(item);
471-
/// futures_util::future::ready(Ok(acc))
471+
/// std::future::ready(Ok(acc))
472472
/// })
473473
/// .await?;
474474
/// let expected_data = vec![

src/stmt_cache.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
use diesel::connection::statement_cache::{MaybeCached, StatementCallbackReturnType};
22
use diesel::QueryResult;
33
use futures_core::future::BoxFuture;
4-
use futures_util::{future, FutureExt, TryFutureExt};
5-
use std::future::Future;
4+
use futures_util::future::Either;
5+
use futures_util::{FutureExt, TryFutureExt};
6+
use std::future::{self, Future};
67

78
pub(crate) struct CallbackHelper<F>(pub(crate) F);
89

9-
type PrepareFuture<'a, C, S> = future::Either<
10+
type PrepareFuture<'a, C, S> = Either<
1011
future::Ready<QueryResult<(MaybeCached<'a, S>, C)>>,
1112
BoxFuture<'a, QueryResult<(MaybeCached<'a, S>, C)>>,
1213
>;
@@ -19,22 +20,22 @@ where
1920
type Return<'a> = PrepareFuture<'a, C, S>;
2021

2122
fn from_error<'a>(e: diesel::result::Error) -> Self::Return<'a> {
22-
future::Either::Left(future::ready(Err(e)))
23+
Either::Left(future::ready(Err(e)))
2324
}
2425

2526
fn map_to_no_cache<'a>(self) -> Self::Return<'a>
2627
where
2728
Self: 'a,
2829
{
29-
future::Either::Right(
30+
Either::Right(
3031
self.0
3132
.map_ok(|(stmt, conn)| (MaybeCached::CannotCache(stmt), conn))
3233
.boxed(),
3334
)
3435
}
3536

3637
fn map_to_cache(stmt: &mut S, conn: C) -> Self::Return<'_> {
37-
future::Either::Left(future::ready(Ok((MaybeCached::Cached(stmt), conn))))
38+
Either::Left(future::ready(Ok((MaybeCached::Cached(stmt), conn))))
3839
}
3940

4041
fn register_cache<'a>(
@@ -44,7 +45,7 @@ where
4445
where
4546
Self: 'a,
4647
{
47-
future::Either::Right(
48+
Either::Right(
4849
self.0
4950
.map_ok(|(stmt, conn)| (MaybeCached::Cached(callback(stmt)), conn))
5051
.boxed(),

0 commit comments

Comments
 (0)