diff --git a/actix-cors/src/lib.rs b/actix-cors/src/lib.rs index 5d0d013e..ea1eb383 100644 --- a/actix-cors/src/lib.rs +++ b/actix-cors/src/lib.rs @@ -681,7 +681,7 @@ where type Error = Error; type Future = Either< FutureResult<Self::Response, Error>, - Either<S::Future, Box<Future<Item = Self::Response, Error = Error>>>, + Either<S::Future, Box<dyn Future<Item = Self::Response, Error = Error>>>, >; fn poll_ready(&mut self) -> Poll<(), Self::Error> { diff --git a/actix-files/src/lib.rs b/actix-files/src/lib.rs index 8e87f7d8..82abb999 100644 --- a/actix-files/src/lib.rs +++ b/actix-files/src/lib.rs @@ -50,7 +50,7 @@ pub struct ChunkedReadFile { size: u64, offset: u64, file: Option<File>, - fut: Option<Box<Future<Item = (File, Bytes), Error = BlockingError<io::Error>>>>, + fut: Option<Box<dyn Future<Item = (File, Bytes), Error = BlockingError<io::Error>>>>, counter: u64, } @@ -370,7 +370,7 @@ impl NewService for Files { type Error = Error; type Service = FilesService; type InitError = (); - type Future = Box<Future<Item = Self::Service, Error = Self::InitError>>; + type Future = Box<dyn Future<Item = Self::Service, Error = Self::InitError>>; fn new_service(&self, _: &()) -> Self::Future { let mut srv = FilesService { @@ -416,7 +416,7 @@ impl FilesService { req: ServiceRequest, ) -> Either< FutureResult<ServiceResponse, Error>, - Box<Future<Item = ServiceResponse, Error = Error>>, + Box<dyn Future<Item = ServiceResponse, Error = Error>>, > { log::debug!("Files: Failed to handle {}: {}", req.path(), e); if let Some(ref mut default) = self.default { @@ -433,7 +433,7 @@ impl Service for FilesService { type Error = Error; type Future = Either< FutureResult<Self::Response, Self::Error>, - Box<Future<Item = Self::Response, Error = Self::Error>>, + Box<dyn Future<Item = Self::Response, Error = Self::Error>>, >; fn poll_ready(&mut self) -> Poll<(), Self::Error> { diff --git a/actix-framed/src/app.rs b/actix-framed/src/app.rs index 297796bd..a9d73a25 100644 --- a/actix-framed/src/app.rs +++ b/actix-framed/src/app.rs @@ -13,7 +13,7 @@ use crate::helpers::{BoxedHttpNewService, BoxedHttpService, HttpNewService}; use crate::request::FramedRequest; use crate::state::State; -type BoxedResponse = Box<Future<Item = (), Error = Error>>; +type BoxedResponse = Box<dyn Future<Item = (), Error = Error>>; pub trait HttpServiceFactory { type Factory: NewService; @@ -61,7 +61,7 @@ impl<T: 'static, S: 'static> FramedApp<T, S> { Request = FramedRequest<T, S>, Response = (), Error = Error, - Future = Box<Future<Item = (), Error = Error>>, + Future = Box<dyn Future<Item = (), Error = Error>>, >, { let path = factory.path().to_string(); @@ -129,7 +129,7 @@ pub struct CreateService<T, S> { enum CreateServiceItem<T, S> { Future( Option<String>, - Box<Future<Item = BoxedHttpService<FramedRequest<T, S>>, Error = ()>>, + Box<dyn Future<Item = BoxedHttpService<FramedRequest<T, S>>, Error = ()>>, ), Service(String, BoxedHttpService<FramedRequest<T, S>>), } diff --git a/actix-framed/src/helpers.rs b/actix-framed/src/helpers.rs index 944b729d..5e84ad88 100644 --- a/actix-framed/src/helpers.rs +++ b/actix-framed/src/helpers.rs @@ -7,7 +7,7 @@ pub(crate) type BoxedHttpService<Req> = Box< Request = Req, Response = (), Error = Error, - Future = Box<Future<Item = (), Error = Error>>, + Future = Box<dyn Future<Item = (), Error = Error>>, >, >; @@ -19,7 +19,7 @@ pub(crate) type BoxedHttpNewService<Req> = Box< Error = Error, InitError = (), Service = BoxedHttpService<Req>, - Future = Box<Future<Item = BoxedHttpService<Req>, Error = ()>>, + Future = Box<dyn Future<Item = BoxedHttpService<Req>, Error = ()>>, >, >; @@ -30,7 +30,7 @@ where T: NewService<Response = (), Error = Error>, T::Response: 'static, T::Future: 'static, - T::Service: Service<Future = Box<Future<Item = (), Error = Error>>> + 'static, + T::Service: Service<Future = Box<dyn Future<Item = (), Error = Error>>> + 'static, <T::Service as Service>::Future: 'static, { pub fn new(service: T) -> Self { @@ -43,7 +43,7 @@ where T: NewService<Config = (), Response = (), Error = Error>, T::Request: 'static, T::Future: 'static, - T::Service: Service<Future = Box<Future<Item = (), Error = Error>>> + 'static, + T::Service: Service<Future = Box<dyn Future<Item = (), Error = Error>>> + 'static, <T::Service as Service>::Future: 'static, { type Config = (); @@ -52,7 +52,7 @@ where type Error = Error; type InitError = (); type Service = BoxedHttpService<T::Request>; - type Future = Box<Future<Item = Self::Service, Error = ()>>; + type Future = Box<dyn Future<Item = Self::Service, Error = ()>>; fn new_service(&self, _: &()) -> Self::Future { Box::new(self.0.new_service(&()).map_err(|_| ()).and_then(|service| { @@ -70,7 +70,7 @@ impl<T> Service for HttpServiceWrapper<T> where T: Service< Response = (), - Future = Box<Future<Item = (), Error = Error>>, + Future = Box<dyn Future<Item = (), Error = Error>>, Error = Error, >, T::Request: 'static, @@ -78,7 +78,7 @@ where type Request = T::Request; type Response = (); type Error = Error; - type Future = Box<Future<Item = (), Error = Error>>; + type Future = Box<dyn Future<Item = (), Error = Error>>; fn poll_ready(&mut self) -> Poll<(), Self::Error> { self.service.poll_ready() diff --git a/actix-framed/src/route.rs b/actix-framed/src/route.rs index c50401d6..5beb2416 100644 --- a/actix-framed/src/route.rs +++ b/actix-framed/src/route.rs @@ -140,7 +140,7 @@ where type Request = FramedRequest<Io, S>; type Response = (); type Error = Error; - type Future = Box<Future<Item = (), Error = Error>>; + type Future = Box<dyn Future<Item = (), Error = Error>>; fn poll_ready(&mut self) -> Poll<(), Self::Error> { Ok(Async::Ready(())) diff --git a/actix-http/src/client/connection.rs b/actix-http/src/client/connection.rs index 9354fca4..2f3103d4 100644 --- a/actix-http/src/client/connection.rs +++ b/actix-http/src/client/connection.rs @@ -94,7 +94,8 @@ where T: AsyncRead + AsyncWrite + 'static, { type Io = T; - type Future = Box<Future<Item = (ResponseHead, Payload), Error = SendRequestError>>; + type Future = + Box<dyn Future<Item = (ResponseHead, Payload), Error = SendRequestError>>; fn protocol(&self) -> Protocol { match self.io { @@ -169,7 +170,8 @@ where B: AsyncRead + AsyncWrite + 'static, { type Io = EitherIo<A, B>; - type Future = Box<Future<Item = (ResponseHead, Payload), Error = SendRequestError>>; + type Future = + Box<dyn Future<Item = (ResponseHead, Payload), Error = SendRequestError>>; fn protocol(&self) -> Protocol { match self { diff --git a/actix-identity/src/lib.rs b/actix-identity/src/lib.rs index 6664df67..fe7216a0 100644 --- a/actix-identity/src/lib.rs +++ b/actix-identity/src/lib.rs @@ -261,7 +261,7 @@ where type Request = ServiceRequest; type Response = ServiceResponse<B>; type Error = Error; - type Future = Box<Future<Item = Self::Response, Error = Self::Error>>; + type Future = Box<dyn Future<Item = Self::Response, Error = Self::Error>>; fn poll_ready(&mut self) -> Poll<(), Self::Error> { self.service.borrow_mut().poll_ready() diff --git a/actix-session/src/cookie.rs b/actix-session/src/cookie.rs index 8627ce4c..87fc0b16 100644 --- a/actix-session/src/cookie.rs +++ b/actix-session/src/cookie.rs @@ -309,7 +309,7 @@ where type Request = ServiceRequest; type Response = ServiceResponse<B>; type Error = S::Error; - type Future = Box<Future<Item = Self::Response, Error = Self::Error>>; + type Future = Box<dyn Future<Item = Self::Response, Error = Self::Error>>; fn poll_ready(&mut self) -> Poll<(), Self::Error> { self.service.poll_ready() diff --git a/awc/src/connect.rs b/awc/src/connect.rs index 4b564d77..8344abbd 100644 --- a/awc/src/connect.rs +++ b/awc/src/connect.rs @@ -20,7 +20,7 @@ pub(crate) trait Connect { head: RequestHead, body: Body, addr: Option<net::SocketAddr>, - ) -> Box<Future<Item = ClientResponse, Error = SendRequestError>>; + ) -> Box<dyn Future<Item = ClientResponse, Error = SendRequestError>>; /// Send request, returns Response and Framed fn open_tunnel( @@ -49,7 +49,7 @@ where head: RequestHead, body: Body, addr: Option<net::SocketAddr>, - ) -> Box<Future<Item = ClientResponse, Error = SendRequestError>> { + ) -> Box<dyn Future<Item = ClientResponse, Error = SendRequestError>> { Box::new( self.0 // connect to the host diff --git a/src/app_service.rs b/src/app_service.rs index 8ab9b352..6012dcda 100644 --- a/src/app_service.rs +++ b/src/app_service.rs @@ -23,7 +23,7 @@ type HttpService = BoxedService<ServiceRequest, ServiceResponse, Error>; type HttpNewService = BoxedNewService<(), ServiceRequest, ServiceResponse, Error, ()>; type BoxedResponse = Either< FutureResult<ServiceResponse, Error>, - Box<Future<Item = ServiceResponse, Error = Error>>, + Box<dyn Future<Item = ServiceResponse, Error = Error>>, >; type FnDataFactory = Box<Fn() -> Box<dyn Future<Item = Box<DataFactory>, Error = ()>>>; @@ -297,14 +297,14 @@ impl NewService for AppRoutingFactory { } } -type HttpServiceFut = Box<Future<Item = HttpService, Error = ()>>; +type HttpServiceFut = Box<dyn Future<Item = HttpService, Error = ()>>; /// Create app service #[doc(hidden)] pub struct AppRoutingFactoryResponse { fut: Vec<CreateAppRoutingItem>, default: Option<HttpService>, - default_fut: Option<Box<Future<Item = HttpService, Error = ()>>>, + default_fut: Option<Box<dyn Future<Item = HttpService, Error = ()>>>, } enum CreateAppRoutingItem { diff --git a/src/extract.rs b/src/extract.rs index 17b5cb40..1687973a 100644 --- a/src/extract.rs +++ b/src/extract.rs @@ -94,7 +94,7 @@ where { type Config = T::Config; type Error = Error; - type Future = Box<Future<Item = Option<T>, Error = Error>>; + type Future = Box<dyn Future<Item = Option<T>, Error = Error>>; #[inline] fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future { @@ -165,7 +165,7 @@ where { type Config = T::Config; type Error = Error; - type Future = Box<Future<Item = Result<T, T::Error>, Error = Error>>; + type Future = Box<dyn Future<Item = Result<T, T::Error>, Error = Error>>; #[inline] fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future { diff --git a/src/middleware/defaultheaders.rs b/src/middleware/defaultheaders.rs index bddcdd55..ab2d36c2 100644 --- a/src/middleware/defaultheaders.rs +++ b/src/middleware/defaultheaders.rs @@ -119,7 +119,7 @@ where type Request = ServiceRequest; type Response = ServiceResponse<B>; type Error = Error; - type Future = Box<Future<Item = Self::Response, Error = Self::Error>>; + type Future = Box<dyn Future<Item = Self::Response, Error = Self::Error>>; fn poll_ready(&mut self) -> Poll<(), Self::Error> { self.service.poll_ready() diff --git a/src/middleware/errhandlers.rs b/src/middleware/errhandlers.rs index ac166e0e..afe7c72f 100644 --- a/src/middleware/errhandlers.rs +++ b/src/middleware/errhandlers.rs @@ -15,7 +15,7 @@ pub enum ErrorHandlerResponse<B> { /// New http response got generated Response(ServiceResponse<B>), /// Result is a future that resolves to a new http response - Future(Box<Future<Item = ServiceResponse<B>, Error = Error>>), + Future(Box<dyn Future<Item = ServiceResponse<B>, Error = Error>>), } type ErrorHandler<B> = Fn(ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>>; @@ -117,7 +117,7 @@ where type Request = ServiceRequest; type Response = ServiceResponse<B>; type Error = Error; - type Future = Box<Future<Item = Self::Response, Error = Self::Error>>; + type Future = Box<dyn Future<Item = Self::Response, Error = Self::Error>>; fn poll_ready(&mut self) -> Poll<(), Self::Error> { self.service.poll_ready() diff --git a/src/resource.rs b/src/resource.rs index c2691eeb..d09beb27 100644 --- a/src/resource.rs +++ b/src/resource.rs @@ -245,7 +245,7 @@ where /// ```rust /// # use actix_web::*; /// # use futures::future::Future; - /// # fn index(req: HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> { + /// # fn index(req: HttpRequest) -> Box<dyn Future<Item=HttpResponse, Error=Error>> { /// # unimplemented!() /// # } /// App::new().service(web::resource("/").route(web::route().to_async(index))); @@ -478,7 +478,7 @@ pub struct CreateResourceService { fut: Vec<CreateRouteServiceItem>, data: Option<Rc<Extensions>>, default: Option<HttpService>, - default_fut: Option<Box<Future<Item = HttpService, Error = ()>>>, + default_fut: Option<Box<dyn Future<Item = HttpService, Error = ()>>>, } impl Future for CreateResourceService { @@ -542,7 +542,7 @@ impl Service for ResourceService { type Error = Error; type Future = Either< FutureResult<ServiceResponse, Error>, - Box<Future<Item = ServiceResponse, Error = Error>>, + Box<dyn Future<Item = ServiceResponse, Error = Error>>, >; fn poll_ready(&mut self) -> Poll<(), Self::Error> { diff --git a/src/responder.rs b/src/responder.rs index 39927c78..4988ad5b 100644 --- a/src/responder.rs +++ b/src/responder.rs @@ -337,7 +337,7 @@ impl<T: Responder> Future for CustomResponderFut<T> { /// use actix_web::{Either, Error, HttpResponse}; /// /// type RegisterResult = -/// Either<HttpResponse, Box<Future<Item = HttpResponse, Error = Error>>>; +/// Either<HttpResponse, Box<dyn Future<Item = HttpResponse, Error = Error>>>; /// /// fn index() -> RegisterResult { /// if is_a_variant() { @@ -411,13 +411,13 @@ where } } -impl<I, E> Responder for Box<Future<Item = I, Error = E>> +impl<I, E> Responder for Box<dyn Future<Item = I, Error = E>> where I: Responder + 'static, E: Into<Error> + 'static, { type Error = Error; - type Future = Box<Future<Item = Response, Error = Error>>; + type Future = Box<dyn Future<Item = Response, Error = Error>>; #[inline] fn respond_to(self, req: &HttpRequest) -> Self::Future { diff --git a/src/route.rs b/src/route.rs index 660b8200..591175d1 100644 --- a/src/route.rs +++ b/src/route.rs @@ -19,7 +19,7 @@ type BoxedRouteService<Req, Res> = Box< Error = Error, Future = Either< FutureResult<Res, Error>, - Box<Future<Item = Res, Error = Error>>, + Box<dyn Future<Item = Res, Error = Error>>, >, >, >; @@ -32,7 +32,7 @@ type BoxedRouteNewService<Req, Res> = Box< Error = Error, InitError = (), Service = BoxedRouteService<Req, Res>, - Future = Box<Future<Item = BoxedRouteService<Req, Res>, Error = ()>>, + Future = Box<dyn Future<Item = BoxedRouteService<Req, Res>, Error = ()>>, >, >; @@ -78,8 +78,9 @@ impl NewService for Route { } } -type RouteFuture = - Box<Future<Item = BoxedRouteService<ServiceRequest, ServiceResponse>, Error = ()>>; +type RouteFuture = Box< + dyn Future<Item = BoxedRouteService<ServiceRequest, ServiceResponse>, Error = ()>, +>; pub struct CreateRouteService { fut: RouteFuture, @@ -123,7 +124,7 @@ impl Service for RouteService { type Error = Error; type Future = Either< FutureResult<Self::Response, Self::Error>, - Box<Future<Item = Self::Response, Error = Self::Error>>, + Box<dyn Future<Item = Self::Response, Error = Self::Error>>, >; fn poll_ready(&mut self) -> Poll<(), Self::Error> { @@ -317,7 +318,7 @@ where type Error = Error; type InitError = (); type Service = BoxedRouteService<ServiceRequest, Self::Response>; - type Future = Box<Future<Item = Self::Service, Error = Self::InitError>>; + type Future = Box<dyn Future<Item = Self::Service, Error = Self::InitError>>; fn new_service(&self, _: &()) -> Self::Future { Box::new( @@ -351,7 +352,7 @@ where type Error = Error; type Future = Either< FutureResult<Self::Response, Self::Error>, - Box<Future<Item = Self::Response, Error = Self::Error>>, + Box<dyn Future<Item = Self::Response, Error = Self::Error>>, >; fn poll_ready(&mut self) -> Poll<(), Self::Error> { diff --git a/src/scope.rs b/src/scope.rs index 400da668..99afd7d1 100644 --- a/src/scope.rs +++ b/src/scope.rs @@ -28,7 +28,7 @@ type HttpService = BoxedService<ServiceRequest, ServiceResponse, Error>; type HttpNewService = BoxedNewService<(), ServiceRequest, ServiceResponse, Error, ()>; type BoxedResponse = Either< FutureResult<ServiceResponse, Error>, - Box<Future<Item = ServiceResponse, Error = Error>>, + Box<dyn Future<Item = ServiceResponse, Error = Error>>, >; /// Resources scope. @@ -503,10 +503,10 @@ pub struct ScopeFactoryResponse { fut: Vec<CreateScopeServiceItem>, data: Option<Rc<Extensions>>, default: Option<HttpService>, - default_fut: Option<Box<Future<Item = HttpService, Error = ()>>>, + default_fut: Option<Box<dyn Future<Item = HttpService, Error = ()>>>, } -type HttpServiceFut = Box<Future<Item = HttpService, Error = ()>>; +type HttpServiceFut = Box<dyn Future<Item = HttpService, Error = ()>>; enum CreateScopeServiceItem { Future(Option<ResourceDef>, Option<Guards>, HttpServiceFut), diff --git a/src/types/form.rs b/src/types/form.rs index 32d0edb6..e61145b0 100644 --- a/src/types/form.rs +++ b/src/types/form.rs @@ -73,7 +73,7 @@ where { type Config = FormConfig; type Error = Error; - type Future = Box<Future<Item = Self, Error = Error>>; + type Future = Box<dyn Future<Item = Self, Error = Error>>; #[inline] fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future { @@ -187,7 +187,7 @@ pub struct UrlEncoded<U> { length: Option<usize>, encoding: &'static Encoding, err: Option<UrlencodedError>, - fut: Option<Box<Future<Item = U, Error = UrlencodedError>>>, + fut: Option<Box<dyn Future<Item = U, Error = UrlencodedError>>>, } impl<U> UrlEncoded<U> { diff --git a/src/types/json.rs b/src/types/json.rs index de0ffb54..f309a3c5 100644 --- a/src/types/json.rs +++ b/src/types/json.rs @@ -169,7 +169,7 @@ where T: DeserializeOwned + 'static, { type Error = Error; - type Future = Box<Future<Item = Self, Error = Error>>; + type Future = Box<dyn Future<Item = Self, Error = Error>>; type Config = JsonConfig; #[inline] @@ -290,7 +290,7 @@ pub struct JsonBody<U> { length: Option<usize>, stream: Option<Decompress<Payload>>, err: Option<JsonPayloadError>, - fut: Option<Box<Future<Item = U, Error = JsonPayloadError>>>, + fut: Option<Box<dyn Future<Item = U, Error = JsonPayloadError>>>, } impl<U> JsonBody<U> diff --git a/src/types/payload.rs b/src/types/payload.rs index a8e85e4f..8a634b4c 100644 --- a/src/types/payload.rs +++ b/src/types/payload.rs @@ -124,7 +124,7 @@ impl FromRequest for Bytes { type Config = PayloadConfig; type Error = Error; type Future = - Either<Box<Future<Item = Bytes, Error = Error>>, FutureResult<Bytes, Error>>; + Either<Box<dyn Future<Item = Bytes, Error = Error>>, FutureResult<Bytes, Error>>; #[inline] fn from_request(req: &HttpRequest, payload: &mut dev::Payload) -> Self::Future { @@ -177,8 +177,10 @@ impl FromRequest for Bytes { impl FromRequest for String { type Config = PayloadConfig; type Error = Error; - type Future = - Either<Box<Future<Item = String, Error = Error>>, FutureResult<String, Error>>; + type Future = Either< + Box<dyn Future<Item = String, Error = Error>>, + FutureResult<String, Error>, + >; #[inline] fn from_request(req: &HttpRequest, payload: &mut dev::Payload) -> Self::Future { @@ -291,7 +293,7 @@ pub struct HttpMessageBody { length: Option<usize>, stream: Option<dev::Decompress<dev::Payload>>, err: Option<PayloadError>, - fut: Option<Box<Future<Item = Bytes, Error = PayloadError>>>, + fut: Option<Box<dyn Future<Item = Bytes, Error = PayloadError>>>, } impl HttpMessageBody {