From f955e499301ffadffecb0669e5c76ad2dff3b1ae Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 12 Mar 2020 04:22:38 +0900 Subject: [PATCH] actix-connect: Minimize `futures-*` dependencies --- actix-connect/Cargo.toml | 2 +- actix-connect/src/connector.rs | 2 +- actix-connect/src/resolve.rs | 2 +- actix-connect/src/service.rs | 2 +- actix-connect/src/ssl/openssl.rs | 6 +++--- actix-connect/src/ssl/rustls.rs | 4 ++-- actix-connect/tests/test_connect.rs | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/actix-connect/Cargo.toml b/actix-connect/Cargo.toml index fb1674e5..739dfee8 100644 --- a/actix-connect/Cargo.toml +++ b/actix-connect/Cargo.toml @@ -37,7 +37,7 @@ actix-utils = "1.0.6" actix-rt = "1.0.0" derive_more = "0.99.2" either = "1.5.3" -futures = "0.3.1" +futures-util = { version = "0.3.4", default-features = false } http = { version = "0.2.0", optional = true } log = "0.4" trust-dns-proto = { version = "0.19", default-features = false, features = ["tokio-runtime"] } diff --git a/actix-connect/src/connector.rs b/actix-connect/src/connector.rs index e2ed8e2b..d631d684 100644 --- a/actix-connect/src/connector.rs +++ b/actix-connect/src/connector.rs @@ -8,7 +8,7 @@ use std::task::{Context, Poll}; use actix_rt::net::TcpStream; use actix_service::{Service, ServiceFactory}; -use futures::future::{err, ok, BoxFuture, Either, FutureExt, Ready}; +use futures_util::future::{err, ok, BoxFuture, Either, FutureExt, Ready}; use super::connect::{Address, Connect, Connection}; use super::error::ConnectError; diff --git a/actix-connect/src/resolve.rs b/actix-connect/src/resolve.rs index 70dd511a..faf68a19 100644 --- a/actix-connect/src/resolve.rs +++ b/actix-connect/src/resolve.rs @@ -5,7 +5,7 @@ use std::pin::Pin; use std::task::{Context, Poll}; use actix_service::{Service, ServiceFactory}; -use futures::future::{ok, Either, Ready}; +use futures_util::future::{ok, Either, Ready}; use trust_dns_resolver::TokioAsyncResolver as AsyncResolver; use trust_dns_resolver::{error::ResolveError, lookup_ip::LookupIp}; diff --git a/actix-connect/src/service.rs b/actix-connect/src/service.rs index dcd03d2c..f337382b 100644 --- a/actix-connect/src/service.rs +++ b/actix-connect/src/service.rs @@ -5,7 +5,7 @@ use std::task::{Context, Poll}; use actix_rt::net::TcpStream; use actix_service::{Service, ServiceFactory}; use either::Either; -use futures::future::{ok, Ready}; +use futures_util::future::{ok, Ready}; use trust_dns_resolver::TokioAsyncResolver as AsyncResolver; use crate::connect::{Address, Connect, Connection}; diff --git a/actix-connect/src/ssl/openssl.rs b/actix-connect/src/ssl/openssl.rs index c9cf666e..6858adbe 100644 --- a/actix-connect/src/ssl/openssl.rs +++ b/actix-connect/src/ssl/openssl.rs @@ -10,7 +10,7 @@ pub use tokio_openssl::{HandshakeError, SslStream}; use actix_codec::{AsyncRead, AsyncWrite}; use actix_rt::net::TcpStream; use actix_service::{Service, ServiceFactory}; -use futures::future::{err, ok, Either, FutureExt, LocalBoxFuture, Ready}; +use futures_util::future::{err, ok, Either, FutureExt, LocalBoxFuture, Ready}; use trust_dns_resolver::TokioAsyncResolver as AsyncResolver; use crate::{ @@ -243,7 +243,7 @@ impl Future for OpensslConnectServiceResponse { fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { if let Some(ref mut fut) = self.fut1 { - match futures::ready!(Pin::new(fut).poll(cx)) { + match futures_util::ready!(Pin::new(fut).poll(cx)) { Ok(res) => { let _ = self.fut1.take(); self.fut2 = Some(self.openssl.call(res)); @@ -253,7 +253,7 @@ impl Future for OpensslConnectServiceResponse { } if let Some(ref mut fut) = self.fut2 { - match futures::ready!(Pin::new(fut).poll(cx)) { + match futures_util::ready!(Pin::new(fut).poll(cx)) { Ok(connect) => Poll::Ready(Ok(connect.into_parts().0)), Err(e) => Poll::Ready(Err(ConnectError::Io(io::Error::new( io::ErrorKind::Other, diff --git a/actix-connect/src/ssl/rustls.rs b/actix-connect/src/ssl/rustls.rs index 1964b3aa..3e646082 100644 --- a/actix-connect/src/ssl/rustls.rs +++ b/actix-connect/src/ssl/rustls.rs @@ -10,7 +10,7 @@ pub use tokio_rustls::{client::TlsStream, rustls::ClientConfig}; use actix_codec::{AsyncRead, AsyncWrite}; use actix_service::{Service, ServiceFactory}; -use futures::future::{ok, Ready}; +use futures_util::future::{ok, Ready}; use tokio_rustls::{Connect, TlsConnector}; use webpki::DNSNameRef; @@ -126,7 +126,7 @@ where fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let this = self.get_mut(); Poll::Ready( - futures::ready!(Pin::new(&mut this.fut).poll(cx)).map(|stream| { + futures_util::ready!(Pin::new(&mut this.fut).poll(cx)).map(|stream| { let s = this.stream.take().unwrap(); trace!("SSL Handshake success: {:?}", s.host()); s.replace(stream).1 diff --git a/actix-connect/tests/test_connect.rs b/actix-connect/tests/test_connect.rs index 1712bf49..549d559f 100644 --- a/actix-connect/tests/test_connect.rs +++ b/actix-connect/tests/test_connect.rs @@ -5,7 +5,7 @@ use actix_rt::net::TcpStream; use actix_service::{fn_service, Service, ServiceFactory}; use actix_testing::TestServer; use bytes::Bytes; -use futures::SinkExt; +use futures_util::sink::SinkExt; use actix_connect::resolver::{ResolverConfig, ResolverOpts}; use actix_connect::Connect;