Remove extraneous dependency on 'futures-util'.

This commit is contained in:
Jeb Rosen 2020-06-14 08:57:56 -07:00 committed by Sergio Benitez
parent bc1b90cbdb
commit c7c371910b
16 changed files with 20 additions and 21 deletions

View File

@ -27,7 +27,6 @@ ctrl_c_shutdown = ["tokio/signal"]
[dependencies]
rocket_codegen = { version = "0.5.0-dev", path = "../codegen" }
rocket_http = { version = "0.5.0-dev", path = "../http" }
futures-util = "0.3.0"
futures = "0.3.0"
tokio = { version = "0.2.9", features = ["fs", "io-std", "io-util", "rt-threaded", "sync"] }
yansi = "0.5"

View File

@ -155,7 +155,7 @@ macro_rules! default_catchers {
let mut map = HashMap::new();
$(
fn $fn_name<'r>(req: &'r Request<'_>) -> futures_util::future::BoxFuture<'r, response::Result<'r>> {
fn $fn_name<'r>(req: &'r Request<'_>) -> futures::future::BoxFuture<'r, response::Result<'r>> {
status::Custom(Status::from_code($code).unwrap(),
content::Html(error_page_template!($code, $name, $description))
).respond_to(req)

View File

@ -1,4 +1,4 @@
use futures_util::future::BoxFuture;
use crate::futures::future::BoxFuture;
use crate::{Request, Data};
use crate::handler::{Outcome, ErrorHandler};

View File

@ -1,7 +1,7 @@
use std::borrow::Borrow;
use futures_util::future::BoxFuture;
use futures_util::future::{ready, FutureExt};
use futures::future::BoxFuture;
use futures::future::{ready, FutureExt};
use crate::outcome::{self, IntoOutcome};
use crate::outcome::Outcome::*;

View File

@ -2,7 +2,7 @@ use std::io::{self, Cursor};
use std::pin::Pin;
use std::task::{Poll, Context};
use futures_util::{ready, future::BoxFuture, stream::Stream};
use futures::{ready, future::BoxFuture, stream::Stream};
use tokio::io::{AsyncRead, AsyncReadExt as _};
use crate::http::hyper;

View File

@ -1,6 +1,6 @@
use std::sync::Mutex;
use futures_util::future::{Future, BoxFuture};
use futures::future::{Future, BoxFuture};
use crate::{Manifest, Rocket, Request, Response, Data};
use crate::fairing::{Fairing, Kind, Info};

View File

@ -1,6 +1,6 @@
//! Types and traits for request and error handlers and their return values.
use futures_util::future::BoxFuture;
use futures::future::BoxFuture;
use crate::data::Data;
use crate::request::Request;

View File

@ -215,7 +215,7 @@ impl<'f, T: FromForm<'f> + Send + 'f> FromData<'f> for Form<T> {
}
fn from_data(_: &'f Request<'_>, o: Transformed<'f, Self>) -> FromDataFuture<'f, Self, Self::Error> {
Box::pin(futures_util::future::ready(o.borrowed().and_then(|data| {
Box::pin(futures::future::ready(o.borrowed().and_then(|data| {
<Form<T>>::from_data(data, true).map(Form)
})))
}

View File

@ -105,7 +105,7 @@ impl<'f, T: FromForm<'f> + Send + 'f> FromData<'f> for LenientForm<T> {
}
fn from_data(_: &'f Request<'_>, o: Transformed<'f, Self>) -> FromDataFuture<'f, Self, Self::Error> {
Box::pin(futures_util::future::ready(o.borrowed().and_then(|form| {
Box::pin(futures::future::ready(o.borrowed().and_then(|form| {
<Form<T>>::from_data(form, false).map(LenientForm)
})))
}

View File

@ -1,7 +1,7 @@
use std::fmt::Debug;
use std::net::SocketAddr;
use futures_util::future::BoxFuture;
use futures::future::BoxFuture;
use crate::router::Route;
use crate::request::Request;
@ -467,7 +467,7 @@ impl<'a, 'r, T: FromRequest<'a, 'r> + 'a> FromRequest<'a, 'r> for Result<T, T::E
where 'a: 'y, 'r: 'y
{
// TODO: FutureExt::map is a workaround (see rust-lang/rust#60658)
use futures_util::future::FutureExt;
use futures::future::FutureExt;
T::from_request(request).map(|x| match x {
Success(val) => Success(Ok(val)),
Failure((_, e)) => Success(Err(e)),
@ -483,7 +483,7 @@ impl<'a, 'r, T: FromRequest<'a, 'r> + 'a> FromRequest<'a, 'r> for Option<T> {
where 'a: 'y, 'r: 'y
{
// TODO: FutureExt::map is a workaround (see rust-lang/rust#60658)
use futures_util::future::FutureExt;
use futures::future::FutureExt;
T::from_request(request).map(|x| match x {
Success(val) => Success(Some(val)),
Failure(_) | Forward(_) => Success(None),

View File

@ -6,7 +6,7 @@ use std::str;
use yansi::Paint;
use state::{Container, Storage};
use futures_util::future::BoxFuture;
use futures::future::BoxFuture;
use crate::request::{FromParam, FromSegments, FromRequest, Outcome};
use crate::request::{FromFormValue, FormItems, FormItem};

View File

@ -59,7 +59,7 @@ impl<'r, R: Responder<'r> + Send + 'r> Responder<'r> for Content<R> {
macro_rules! ctrs {
($($name:ident: $ct:ident, $name_str:expr, $ct_str:expr),+) => {
use futures_util::future::BoxFuture;
use futures::future::BoxFuture;
$(
#[doc="Override the `Content-Type` of the response to <b>"]

View File

@ -2,7 +2,7 @@ use std::fs::File;
use std::io::Cursor;
use tokio::io::BufReader;
use futures_util::future::BoxFuture;
use futures::future::BoxFuture;
use crate::http::{Status, ContentType, StatusClass};
use crate::response::{self, Response, Body};

View File

@ -5,8 +5,8 @@ use std::io;
use std::mem;
use std::sync::Arc;
use futures_util::future::{Future, FutureExt, BoxFuture};
use futures_util::stream::StreamExt;
use futures::future::{Future, FutureExt, BoxFuture};
use futures::stream::StreamExt;
use tokio::sync::{mpsc, oneshot};
use yansi::Paint;
@ -936,7 +936,7 @@ impl Rocket {
#[cfg(feature = "ctrl_c_shutdown")]
{
tokio::spawn(async move {
use futures_util::future::{select, Either};
use futures::future::{select, Either};
let either = select(
tokio::signal::ctrl_c().boxed(),

View File

@ -3,7 +3,7 @@ mod route;
use std::collections::hash_map::HashMap;
use futures_util::future::BoxFuture;
use futures::future::BoxFuture;
pub use self::route::Route;

View File

@ -27,7 +27,7 @@ impl FromDataSimple for HasContentType {
type Error = ();
fn from_data(request: &Request<'_>, data: Data) -> data::FromDataFuture<'static, Self, Self::Error> {
Box::pin(futures_util::future::ready(if request.content_type().is_some() {
Box::pin(futures::future::ready(if request.content_type().is_some() {
Success(HasContentType)
} else {
Forward(data)