From d7abbff3b0acfa0909a7dd6cd292419881bad746 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Mon, 18 May 2020 11:46:57 +0900 Subject: [PATCH] awc: Minimize `futures` dependencies --- awc/Cargo.toml | 4 ++-- awc/src/lib.rs | 1 - awc/src/request.rs | 2 +- awc/src/response.rs | 3 ++- awc/src/sender.rs | 3 ++- awc/tests/test_client.rs | 2 +- awc/tests/test_rustls_client.rs | 2 +- awc/tests/test_ssl_client.rs | 2 +- awc/tests/test_ws.rs | 4 ++-- 9 files changed, 12 insertions(+), 11 deletions(-) diff --git a/awc/Cargo.toml b/awc/Cargo.toml index 5ccf3165..c31c1902 100644 --- a/awc/Cargo.toml +++ b/awc/Cargo.toml @@ -42,7 +42,7 @@ actix-rt = "1.0.0" base64 = "0.11" bytes = "0.5.3" derive_more = "0.99.2" -futures-core = "0.3.1" +futures-core = { version = "0.3.5", default-features = false } log =" 0.4" mime = "0.3" percent-encoding = "2.1" @@ -63,6 +63,6 @@ actix-server = "1.0.0" actix-tls = { version = "2.0.0-alpha.1", features = ["openssl", "rustls"] } brotli2 = "0.3.2" flate2 = "1.0.13" -futures = "0.3.1" +futures-util = { version = "0.3.5", default-features = false } env_logger = "0.7" webpki = "0.21" diff --git a/awc/src/lib.rs b/awc/src/lib.rs index 952a1536..1cc31a19 100644 --- a/awc/src/lib.rs +++ b/awc/src/lib.rs @@ -7,7 +7,6 @@ //! An HTTP Client //! //! ```rust -//! use futures::future::{lazy, Future}; //! use actix_rt::System; //! use awc::Client; //! diff --git a/awc/src/request.rs b/awc/src/request.rs index 67b063a8..21a7cd91 100644 --- a/awc/src/request.rs +++ b/awc/src/request.rs @@ -156,7 +156,7 @@ impl ClientRequest { /// /// ```rust /// fn main() { - /// # actix_rt::System::new("test").block_on(futures::future::lazy(|_| { + /// # actix_rt::System::new("test").block_on(futures_util::future::lazy(|_| { /// let req = awc::Client::new() /// .get("http://www.rust-lang.org") /// .set(awc::http::header::Date::now()) diff --git a/awc/src/response.rs b/awc/src/response.rs index 20093c72..ffc8c540 100644 --- a/awc/src/response.rs +++ b/awc/src/response.rs @@ -1,11 +1,12 @@ use std::cell::{Ref, RefMut}; use std::fmt; +use std::future::Future; use std::marker::PhantomData; use std::pin::Pin; use std::task::{Context, Poll}; use bytes::{Bytes, BytesMut}; -use futures_core::{ready, Future, Stream}; +use futures_core::{ready, Stream}; use actix_http::cookie::Cookie; use actix_http::error::{CookieParseError, PayloadError}; diff --git a/awc/src/sender.rs b/awc/src/sender.rs index 983e730e..5e0f5bee 100644 --- a/awc/src/sender.rs +++ b/awc/src/sender.rs @@ -1,3 +1,4 @@ +use std::future::Future; use std::net; use std::pin::Pin; use std::rc::Rc; @@ -7,7 +8,7 @@ use std::time::Duration; use actix_rt::time::{delay_for, Delay}; use bytes::Bytes; use derive_more::From; -use futures_core::{Future, Stream}; +use futures_core::Stream; use serde::Serialize; use actix_http::body::{Body, BodyStream}; diff --git a/awc/tests/test_client.rs b/awc/tests/test_client.rs index 449734a9..cc61f100 100644 --- a/awc/tests/test_client.rs +++ b/awc/tests/test_client.rs @@ -9,7 +9,7 @@ use bytes::Bytes; use flate2::read::GzDecoder; use flate2::write::GzEncoder; use flate2::Compression; -use futures::future::ok; +use futures_util::future::ok; use rand::Rng; use actix_http::HttpService; diff --git a/awc/tests/test_rustls_client.rs b/awc/tests/test_rustls_client.rs index 7407a33f..0c6be76d 100644 --- a/awc/tests/test_rustls_client.rs +++ b/awc/tests/test_rustls_client.rs @@ -7,7 +7,7 @@ use actix_http_test::test_server; use actix_service::{map_config, pipeline_factory, ServiceFactory}; use actix_web::http::Version; use actix_web::{dev::AppConfig, web, App, HttpResponse}; -use futures::future::ok; +use futures_util::future::ok; use open_ssl::ssl::{SslAcceptor, SslFiletype, SslMethod, SslVerifyMode}; use rust_tls::ClientConfig; diff --git a/awc/tests/test_ssl_client.rs b/awc/tests/test_ssl_client.rs index 8e128ad0..b2a2e178 100644 --- a/awc/tests/test_ssl_client.rs +++ b/awc/tests/test_ssl_client.rs @@ -7,7 +7,7 @@ use actix_http_test::test_server; use actix_service::{map_config, pipeline_factory, ServiceFactory}; use actix_web::http::Version; use actix_web::{dev::AppConfig, web, App, HttpResponse}; -use futures::future::ok; +use futures_util::future::ok; use open_ssl::ssl::{SslAcceptor, SslConnector, SslFiletype, SslMethod, SslVerifyMode}; fn ssl_acceptor() -> SslAcceptor { diff --git a/awc/tests/test_ws.rs b/awc/tests/test_ws.rs index 779a4301..d3f66814 100644 --- a/awc/tests/test_ws.rs +++ b/awc/tests/test_ws.rs @@ -4,8 +4,8 @@ use actix_codec::Framed; use actix_http::{body::BodySize, h1, ws, Error, HttpService, Request, Response}; use actix_http_test::test_server; use bytes::Bytes; -use futures::future::ok; -use futures::{SinkExt, StreamExt}; +use futures_util::future::ok; +use futures_util::{SinkExt, StreamExt}; async fn ws_service(req: ws::Frame) -> Result { match req {