diff --git a/Cargo.toml b/Cargo.toml index 470644e0e..866a7628f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,7 +75,7 @@ actix-utils = "0.4.4" actix-router = "0.1.5" actix-rt = "0.2.4" actix-web-codegen = "0.1.2" -actix-http = "0.2.5" +actix-http = "0.2.6" actix-server = "0.5.1" actix-server-config = "0.1.1" actix-threadpool = "0.1.1" @@ -89,7 +89,7 @@ hashbrown = "0.5.0" log = "0.4" mime = "0.3" net2 = "0.2.33" -parking_lot = "0.8" +parking_lot = "0.9" regex = "1.0" serde = { version = "1.0", features=["derive"] } serde_json = "1.0" diff --git a/actix-cors/src/lib.rs b/actix-cors/src/lib.rs index d9a44d0b8..c76bae925 100644 --- a/actix-cors/src/lib.rs +++ b/actix-cors/src/lib.rs @@ -587,10 +587,10 @@ impl Inner { } Err(CorsError::BadOrigin) } else { - return match self.origins { + match self.origins { AllOrSome::All => Ok(()), _ => Err(CorsError::MissingOrigin), - }; + } } } @@ -665,7 +665,7 @@ impl Inner { } Err(CorsError::BadRequestHeaders) } else { - return Ok(()); + Ok(()) } } } diff --git a/actix-files/src/lib.rs b/actix-files/src/lib.rs index c870c9dd0..cf07153fa 100644 --- a/actix-files/src/lib.rs +++ b/actix-files/src/lib.rs @@ -107,7 +107,7 @@ impl Stream for ChunkedReadFile { } type DirectoryRenderer = - Fn(&Directory, &HttpRequest) -> Result; + dyn Fn(&Directory, &HttpRequest) -> Result; /// A directory; responds with the generated directory listing. #[derive(Debug)] @@ -211,7 +211,7 @@ fn directory_listing( )) } -type MimeOverride = Fn(&mime::Name) -> DispositionType; +type MimeOverride = dyn Fn(&mime::Name) -> DispositionType; /// Static files handling /// @@ -475,7 +475,7 @@ impl Service for FilesService { Err(e) => ServiceResponse::from_err(e, req), })) } - Err(e) => return self.handle_err(e, req), + Err(e) => self.handle_err(e, req), } } else if self.show_index { let dir = Directory::new(self.directory.clone(), path); @@ -483,7 +483,7 @@ impl Service for FilesService { let x = (self.renderer)(&dir, &req); match x { Ok(resp) => Either::A(ok(resp)), - Err(e) => return Either::A(ok(ServiceResponse::from_err(e, req))), + Err(e) => Either::A(ok(ServiceResponse::from_err(e, req))), } } else { Either::A(ok(ServiceResponse::from_err( @@ -857,7 +857,7 @@ mod tests { #[test] fn test_named_file_content_length_headers() { - use actix_web::body::{MessageBody, ResponseBody}; + // use actix_web::body::{MessageBody, ResponseBody}; let mut srv = test::init_service( App::new().service(Files::new("test", ".").index_file("tests/test.binary")), @@ -868,7 +868,7 @@ mod tests { .uri("/t%65st/tests/test.binary") .header(header::RANGE, "bytes=10-20") .to_request(); - let response = test::call_service(&mut srv, request); + let _response = test::call_service(&mut srv, request); // let contentlength = response // .headers() @@ -891,7 +891,7 @@ mod tests { .uri("/t%65st/tests/test.binary") // .no_default_headers() .to_request(); - let response = test::call_service(&mut srv, request); + let _response = test::call_service(&mut srv, request); // let contentlength = response // .headers() @@ -939,7 +939,7 @@ mod tests { .method(Method::HEAD) .uri("/t%65st/tests/test.binary") .to_request(); - let response = test::call_service(&mut srv, request); + let _response = test::call_service(&mut srv, request); // TODO: fix check // let contentlength = response diff --git a/actix-files/src/range.rs b/actix-files/src/range.rs index d97a35e7e..47673b0b0 100644 --- a/actix-files/src/range.rs +++ b/actix-files/src/range.rs @@ -5,7 +5,7 @@ pub struct HttpRange { pub length: u64, } -static PREFIX: &'static str = "bytes="; +static PREFIX: &str = "bytes="; const PREFIX_LEN: usize = 6; impl HttpRange { diff --git a/actix-framed/src/helpers.rs b/actix-framed/src/helpers.rs index 5e84ad88c..b343301f3 100644 --- a/actix-framed/src/helpers.rs +++ b/actix-framed/src/helpers.rs @@ -3,7 +3,7 @@ use actix_service::{NewService, Service}; use futures::{Future, Poll}; pub(crate) type BoxedHttpService = Box< - Service< + dyn Service< Request = Req, Response = (), Error = Error, @@ -12,7 +12,7 @@ pub(crate) type BoxedHttpService = Box< >; pub(crate) type BoxedHttpNewService = Box< - NewService< + dyn NewService< Config = (), Request = Req, Response = (), diff --git a/actix-http/src/builder.rs b/actix-http/src/builder.rs index b6967d94d..bab0f5e1e 100644 --- a/actix-http/src/builder.rs +++ b/actix-http/src/builder.rs @@ -26,7 +26,7 @@ pub struct HttpServiceBuilder> { client_disconnect: u64, expect: X, upgrade: Option, - on_connect: Option Box>>, + on_connect: Option Box>>, _t: PhantomData<(T, S)>, } diff --git a/actix-http/src/client/connection.rs b/actix-http/src/client/connection.rs index 2f3103d4e..36913c5f0 100644 --- a/actix-http/src/client/connection.rs +++ b/actix-http/src/client/connection.rs @@ -130,7 +130,7 @@ where type TunnelFuture = Either< Box< - Future< + dyn Future< Item = (ResponseHead, Framed), Error = SendRequestError, >, @@ -192,7 +192,7 @@ where } type TunnelFuture = Box< - Future< + dyn Future< Item = (ResponseHead, Framed), Error = SendRequestError, >, diff --git a/actix-http/src/cookie/secure/key.rs b/actix-http/src/cookie/secure/key.rs index 8435ce3ab..39575c93f 100644 --- a/actix-http/src/cookie/secure/key.rs +++ b/actix-http/src/cookie/secure/key.rs @@ -6,7 +6,7 @@ use ring::rand::{SecureRandom, SystemRandom}; use super::private::KEY_LEN as PRIVATE_KEY_LEN; use super::signed::KEY_LEN as SIGNED_KEY_LEN; -static HKDF_DIGEST: &'static Algorithm = &SHA256; +static HKDF_DIGEST: &Algorithm = &SHA256; const KEYS_INFO: &str = "COOKIE;SIGNED:HMAC-SHA256;PRIVATE:AEAD-AES-256-GCM"; /// A cryptographic master key for use with `Signed` and/or `Private` jars. diff --git a/actix-http/src/cookie/secure/private.rs b/actix-http/src/cookie/secure/private.rs index e59743767..eb8e9beb1 100644 --- a/actix-http/src/cookie/secure/private.rs +++ b/actix-http/src/cookie/secure/private.rs @@ -10,7 +10,7 @@ use crate::cookie::{Cookie, CookieJar}; // Keep these in sync, and keep the key len synced with the `private` docs as // well as the `KEYS_INFO` const in secure::Key. -static ALGO: &'static Algorithm = &AES_256_GCM; +static ALGO: &Algorithm = &AES_256_GCM; const NONCE_LEN: usize = 12; pub const KEY_LEN: usize = 32; diff --git a/actix-http/src/cookie/secure/signed.rs b/actix-http/src/cookie/secure/signed.rs index 1b1799cf4..36a277cd5 100644 --- a/actix-http/src/cookie/secure/signed.rs +++ b/actix-http/src/cookie/secure/signed.rs @@ -6,7 +6,7 @@ use crate::cookie::{Cookie, CookieJar}; // Keep these in sync, and keep the key len synced with the `signed` docs as // well as the `KEYS_INFO` const in secure::Key. -static HMAC_DIGEST: &'static Algorithm = &SHA256; +static HMAC_DIGEST: &Algorithm = &SHA256; const BASE64_DIGEST_LEN: usize = 44; pub const KEY_LEN: usize = 32; diff --git a/actix-http/src/error.rs b/actix-http/src/error.rs index 4913c3d9d..368ee6dde 100644 --- a/actix-http/src/error.rs +++ b/actix-http/src/error.rs @@ -43,12 +43,12 @@ pub type Result = result::Result; /// if you have access to an actix `Error` you can always get a /// `ResponseError` reference from it. pub struct Error { - cause: Box, + cause: Box, } impl Error { /// Returns the reference to the underlying `ResponseError`. - pub fn as_response_error(&self) -> &ResponseError { + pub fn as_response_error(&self) -> &dyn ResponseError { self.cause.as_ref() } } diff --git a/actix-http/src/extensions.rs b/actix-http/src/extensions.rs index 148e4c18e..c6266f56e 100644 --- a/actix-http/src/extensions.rs +++ b/actix-http/src/extensions.rs @@ -6,7 +6,7 @@ use hashbrown::HashMap; #[derive(Default)] /// A type map of request extensions. pub struct Extensions { - map: HashMap>, + map: HashMap>, } impl Extensions { @@ -35,14 +35,14 @@ impl Extensions { pub fn get(&self) -> Option<&T> { self.map .get(&TypeId::of::()) - .and_then(|boxed| (&**boxed as &(Any + 'static)).downcast_ref()) + .and_then(|boxed| (&**boxed as &(dyn Any + 'static)).downcast_ref()) } /// Get a mutable reference to a type previously inserted on this `Extensions`. pub fn get_mut(&mut self) -> Option<&mut T> { self.map .get_mut(&TypeId::of::()) - .and_then(|boxed| (&mut **boxed as &mut (Any + 'static)).downcast_mut()) + .and_then(|boxed| (&mut **boxed as &mut (dyn Any + 'static)).downcast_mut()) } /// Remove a type from this `Extensions`. @@ -50,7 +50,7 @@ impl Extensions { /// If a extension of this type existed, it will be returned. pub fn remove(&mut self) -> Option { self.map.remove(&TypeId::of::()).and_then(|boxed| { - (boxed as Box) + (boxed as Box) .downcast() .ok() .map(|boxed| *boxed) diff --git a/actix-http/src/h1/decoder.rs b/actix-http/src/h1/decoder.rs index 12419d665..c7ef065a5 100644 --- a/actix-http/src/h1/decoder.rs +++ b/actix-http/src/h1/decoder.rs @@ -502,15 +502,15 @@ impl ChunkedState { fn read_size(rdr: &mut BytesMut, size: &mut u64) -> Poll { let radix = 16; match byte!(rdr) { - b @ b'0'...b'9' => { + b @ b'0'..=b'9' => { *size *= radix; *size += u64::from(b - b'0'); } - b @ b'a'...b'f' => { + b @ b'a'..=b'f' => { *size *= radix; *size += u64::from(b + 10 - b'a'); } - b @ b'A'...b'F' => { + b @ b'A'..=b'F' => { *size *= radix; *size += u64::from(b + 10 - b'A'); } diff --git a/actix-http/src/h1/service.rs b/actix-http/src/h1/service.rs index 108b7079e..89bf08e9b 100644 --- a/actix-http/src/h1/service.rs +++ b/actix-http/src/h1/service.rs @@ -26,7 +26,7 @@ pub struct H1Service> { cfg: ServiceConfig, expect: X, upgrade: Option, - on_connect: Option Box>>, + on_connect: Option Box>>, _t: PhantomData<(T, P, B)>, } @@ -108,7 +108,7 @@ where /// Set on connect callback. pub(crate) fn on_connect( mut self, - f: Option Box>>, + f: Option Box>>, ) -> Self { self.on_connect = f; self @@ -174,7 +174,7 @@ where fut_upg: Option, expect: Option, upgrade: Option, - on_connect: Option Box>>, + on_connect: Option Box>>, cfg: Option, _t: PhantomData<(T, P, B)>, } @@ -233,7 +233,7 @@ pub struct H1ServiceHandler { srv: CloneableService, expect: CloneableService, upgrade: Option>, - on_connect: Option Box>>, + on_connect: Option Box>>, cfg: ServiceConfig, _t: PhantomData<(T, P, B)>, } @@ -254,7 +254,7 @@ where srv: S, expect: X, upgrade: Option, - on_connect: Option Box>>, + on_connect: Option Box>>, ) -> H1ServiceHandler { H1ServiceHandler { srv: CloneableService::new(srv), diff --git a/actix-http/src/h2/service.rs b/actix-http/src/h2/service.rs index 487d5b6ab..e894cf660 100644 --- a/actix-http/src/h2/service.rs +++ b/actix-http/src/h2/service.rs @@ -27,7 +27,7 @@ use super::dispatcher::Dispatcher; pub struct H2Service { srv: S, cfg: ServiceConfig, - on_connect: Option Box>>, + on_connect: Option Box>>, _t: PhantomData<(T, P, B)>, } @@ -64,7 +64,7 @@ where /// Set on connect callback. pub(crate) fn on_connect( mut self, - f: Option Box>>, + f: Option Box>>, ) -> Self { self.on_connect = f; self @@ -102,7 +102,7 @@ where pub struct H2ServiceResponse { fut: ::Future, cfg: Option, - on_connect: Option Box>>, + on_connect: Option Box>>, _t: PhantomData<(T, P, B)>, } @@ -132,7 +132,7 @@ where pub struct H2ServiceHandler { srv: CloneableService, cfg: ServiceConfig, - on_connect: Option Box>>, + on_connect: Option Box>>, _t: PhantomData<(T, P, B)>, } @@ -146,7 +146,7 @@ where { fn new( cfg: ServiceConfig, - on_connect: Option Box>>, + on_connect: Option Box>>, srv: S, ) -> H2ServiceHandler { H2ServiceHandler { diff --git a/actix-http/src/service.rs b/actix-http/src/service.rs index d37d377e5..be021b252 100644 --- a/actix-http/src/service.rs +++ b/actix-http/src/service.rs @@ -26,7 +26,7 @@ pub struct HttpService, - on_connect: Option Box>>, + on_connect: Option Box>>, _t: PhantomData<(T, P, B)>, } @@ -140,7 +140,7 @@ where /// Set on connect callback. pub(crate) fn on_connect( mut self, - f: Option Box>>, + f: Option Box>>, ) -> Self { self.on_connect = f; self @@ -196,7 +196,7 @@ pub struct HttpServiceResponse, expect: Option, upgrade: Option, - on_connect: Option Box>>, + on_connect: Option Box>>, cfg: Option, _t: PhantomData<(T, P, B)>, } @@ -257,7 +257,7 @@ pub struct HttpServiceHandler { expect: CloneableService, upgrade: Option>, cfg: ServiceConfig, - on_connect: Option Box>>, + on_connect: Option Box>>, _t: PhantomData<(T, P, B, X)>, } @@ -278,7 +278,7 @@ where srv: S, expect: X, upgrade: Option, - on_connect: Option Box>>, + on_connect: Option Box>>, ) -> HttpServiceHandler { HttpServiceHandler { cfg, diff --git a/actix-http/src/ws/proto.rs b/actix-http/src/ws/proto.rs index 9b51b9229..e14651a56 100644 --- a/actix-http/src/ws/proto.rs +++ b/actix-http/src/ws/proto.rs @@ -203,7 +203,7 @@ impl> From<(CloseCode, T)> for CloseReason { } } -static WS_GUID: &'static str = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; +static WS_GUID: &str = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; // TODO: hash is always same size, we dont need String pub fn hash_key(key: &[u8]) -> String { diff --git a/actix-identity/src/lib.rs b/actix-identity/src/lib.rs index 0ae58fe89..7216104eb 100644 --- a/actix-identity/src/lib.rs +++ b/actix-identity/src/lib.rs @@ -283,7 +283,7 @@ where res.request().extensions_mut().remove::(); if let Some(id) = id { - return Either::A( + Either::A( backend .to_response(id.id, id.changed, &mut res) .into_future() @@ -291,7 +291,7 @@ where Ok(_) => Ok(res), Err(e) => Ok(res.error_response(e)), }), - ); + ) } else { Either::B(ok(res)) } diff --git a/actix-session/src/lib.rs b/actix-session/src/lib.rs index 27ad2b876..2e9e51714 100644 --- a/actix-session/src/lib.rs +++ b/actix-session/src/lib.rs @@ -282,7 +282,7 @@ mod tests { #[test] fn purge_session() { - let mut req = test::TestRequest::default().to_srv_request(); + let req = test::TestRequest::default().to_srv_request(); let session = Session::get_session(&mut *req.extensions_mut()); assert_eq!(session.0.borrow().status, SessionStatus::Unchanged); session.purge(); @@ -291,7 +291,7 @@ mod tests { #[test] fn renew_session() { - let mut req = test::TestRequest::default().to_srv_request(); + let req = test::TestRequest::default().to_srv_request(); let session = Session::get_session(&mut *req.extensions_mut()); assert_eq!(session.0.borrow().status, SessionStatus::Unchanged); session.renew(); diff --git a/awc/src/connect.rs b/awc/src/connect.rs index 8344abbdc..04f08ecdc 100644 --- a/awc/src/connect.rs +++ b/awc/src/connect.rs @@ -28,7 +28,7 @@ pub(crate) trait Connect { head: RequestHead, addr: Option, ) -> Box< - Future< + dyn Future< Item = (ResponseHead, Framed), Error = SendRequestError, >, @@ -69,7 +69,7 @@ where head: RequestHead, addr: Option, ) -> Box< - Future< + dyn Future< Item = (ResponseHead, Framed), Error = SendRequestError, >, @@ -93,21 +93,21 @@ where } trait AsyncSocket { - fn as_read(&self) -> &AsyncRead; - fn as_read_mut(&mut self) -> &mut AsyncRead; - fn as_write(&mut self) -> &mut AsyncWrite; + fn as_read(&self) -> &dyn AsyncRead; + fn as_read_mut(&mut self) -> &mut dyn AsyncRead; + fn as_write(&mut self) -> &mut dyn AsyncWrite; } struct Socket(T); impl AsyncSocket for Socket { - fn as_read(&self) -> &AsyncRead { + fn as_read(&self) -> &dyn AsyncRead { &self.0 } - fn as_read_mut(&mut self) -> &mut AsyncRead { + fn as_read_mut(&mut self) -> &mut dyn AsyncRead { &mut self.0 } - fn as_write(&mut self) -> &mut AsyncWrite { + fn as_write(&mut self) -> &mut dyn AsyncWrite { &mut self.0 } } diff --git a/src/app.rs b/src/app.rs index 3b063a841..f93859c7e 100644 --- a/src/app.rs +++ b/src/app.rs @@ -23,16 +23,17 @@ use crate::service::{ }; type HttpNewService = BoxedNewService<(), ServiceRequest, ServiceResponse, Error, ()>; -type FnDataFactory = Box Box, Error = ()>>>; +type FnDataFactory = + Box Box, Error = ()>>>; /// Application builder - structure that follows the builder pattern /// for building application instances. pub struct App { endpoint: T, - services: Vec>, + services: Vec>, default: Option>, factory_ref: Rc>>, - data: Vec>, + data: Vec>, data_factories: Vec, config: AppConfigInner, external: Vec, diff --git a/src/app_service.rs b/src/app_service.rs index 6012dcda9..736c35010 100644 --- a/src/app_service.rs +++ b/src/app_service.rs @@ -18,14 +18,15 @@ use crate::request::{HttpRequest, HttpRequestPool}; use crate::rmap::ResourceMap; use crate::service::{ServiceFactory, ServiceRequest, ServiceResponse}; -type Guards = Vec>; +type Guards = Vec>; type HttpService = BoxedService; type HttpNewService = BoxedNewService<(), ServiceRequest, ServiceResponse, Error, ()>; type BoxedResponse = Either< FutureResult, Box>, >; -type FnDataFactory = Box Box, Error = ()>>>; +type FnDataFactory = + Box Box, Error = ()>>>; /// Service factory to convert `Request` to a `ServiceRequest`. /// It also executes data factories. @@ -40,10 +41,10 @@ where >, { pub(crate) endpoint: T, - pub(crate) data: Rc>>, + pub(crate) data: Rc>>, pub(crate) data_factories: Rc>, pub(crate) config: RefCell, - pub(crate) services: Rc>>>, + pub(crate) services: Rc>>>, pub(crate) default: Option>, pub(crate) factory_ref: Rc>>, pub(crate) external: RefCell>, @@ -142,9 +143,9 @@ where endpoint_fut: T::Future, rmap: Rc, config: AppConfig, - data: Rc>>, - data_factories: Vec>, - data_factories_fut: Vec, Error = ()>>>, + data: Rc>>, + data_factories: Vec>, + data_factories_fut: Vec, Error = ()>>>, _t: PhantomData, } diff --git a/src/config.rs b/src/config.rs index 8de43f36c..bbbb3bb01 100644 --- a/src/config.rs +++ b/src/config.rs @@ -16,7 +16,7 @@ use crate::service::{ ServiceResponse, }; -type Guards = Vec>; +type Guards = Vec>; type HttpNewService = boxed::BoxedNewService<(), ServiceRequest, ServiceResponse, Error, ()>; @@ -31,7 +31,7 @@ pub struct AppService { Option, Option>, )>, - service_data: Rc>>, + service_data: Rc>>, } impl AppService { @@ -39,7 +39,7 @@ impl AppService { pub(crate) fn new( config: AppConfig, default: Rc, - service_data: Rc>>, + service_data: Rc>>, ) -> Self { AppService { config, @@ -101,7 +101,7 @@ impl AppService { pub fn register_service( &mut self, rdef: ResourceDef, - guards: Option>>, + guards: Option>>, service: F, nested: Option>, ) where @@ -174,8 +174,8 @@ impl Default for AppConfigInner { /// to set of external methods. This could help with /// modularization of big application configuration. pub struct ServiceConfig { - pub(crate) services: Vec>, - pub(crate) data: Vec>, + pub(crate) services: Vec>, + pub(crate) data: Vec>, pub(crate) external: Vec, } diff --git a/src/guard.rs b/src/guard.rs index 0990e876a..6522a9845 100644 --- a/src/guard.rs +++ b/src/guard.rs @@ -100,7 +100,7 @@ pub fn Any(guard: F) -> AnyGuard { } /// Matches if any of supplied guards matche. -pub struct AnyGuard(Vec>); +pub struct AnyGuard(Vec>); impl AnyGuard { /// Add guard to a list of guards to check @@ -140,7 +140,7 @@ pub fn All(guard: F) -> AllGuard { } /// Matches if all of supplied guards. -pub struct AllGuard(Vec>); +pub struct AllGuard(Vec>); impl AllGuard { /// Add new guard to the list of guards to check @@ -167,7 +167,7 @@ pub fn Not(guard: F) -> NotGuard { } #[doc(hidden)] -pub struct NotGuard(Box); +pub struct NotGuard(Box); impl Guard for NotGuard { fn check(&self, request: &RequestHead) -> bool { diff --git a/src/middleware/errhandlers.rs b/src/middleware/errhandlers.rs index afe7c72f1..5f73d4d7e 100644 --- a/src/middleware/errhandlers.rs +++ b/src/middleware/errhandlers.rs @@ -18,7 +18,7 @@ pub enum ErrorHandlerResponse { Future(Box, Error = Error>>), } -type ErrorHandler = Fn(ServiceResponse) -> Result>; +type ErrorHandler = dyn Fn(ServiceResponse) -> Result>; /// `Middleware` for allowing custom handlers for responses. /// diff --git a/src/middleware/logger.rs b/src/middleware/logger.rs index 24aabb95d..9e332fb83 100644 --- a/src/middleware/logger.rs +++ b/src/middleware/logger.rs @@ -444,7 +444,9 @@ impl FormatText { } } -pub(crate) struct FormatDisplay<'a>(&'a Fn(&mut Formatter) -> Result<(), fmt::Error>); +pub(crate) struct FormatDisplay<'a>( + &'a dyn Fn(&mut Formatter) -> Result<(), fmt::Error>, +); impl<'a> fmt::Display for FormatDisplay<'a> { fn fmt(&self, fmt: &mut Formatter) -> Result<(), fmt::Error> { diff --git a/src/resource.rs b/src/resource.rs index 0d66aa843..0af43a424 100644 --- a/src/resource.rs +++ b/src/resource.rs @@ -50,7 +50,7 @@ pub struct Resource { name: Option, routes: Vec, data: Option, - guards: Vec>, + guards: Vec>, default: Rc>>>, factory_ref: Rc>>, } @@ -118,7 +118,7 @@ where self } - pub(crate) fn add_guards(mut self, guards: Vec>) -> Self { + pub(crate) fn add_guards(mut self, guards: Vec>) -> Self { self.guards.extend(guards); self } diff --git a/src/route.rs b/src/route.rs index 591175d15..f4d303632 100644 --- a/src/route.rs +++ b/src/route.rs @@ -13,7 +13,7 @@ use crate::service::{ServiceRequest, ServiceResponse}; use crate::HttpResponse; type BoxedRouteService = Box< - Service< + dyn Service< Request = Req, Response = Res, Error = Error, @@ -25,7 +25,7 @@ type BoxedRouteService = Box< >; type BoxedRouteNewService = Box< - NewService< + dyn NewService< Config = (), Request = Req, Response = Res, @@ -42,7 +42,7 @@ type BoxedRouteNewService = Box< /// If handler is not explicitly set, default *404 Not Found* handler is used. pub struct Route { service: BoxedRouteNewService, - guards: Rc>>, + guards: Rc>>, } impl Route { @@ -56,7 +56,7 @@ impl Route { } } - pub(crate) fn take_guards(&mut self) -> Vec> { + pub(crate) fn take_guards(&mut self) -> Vec> { std::mem::replace(Rc::get_mut(&mut self.guards).unwrap(), Vec::new()) } } @@ -84,7 +84,7 @@ type RouteFuture = Box< pub struct CreateRouteService { fut: RouteFuture, - guards: Rc>>, + guards: Rc>>, } impl Future for CreateRouteService { @@ -104,7 +104,7 @@ impl Future for CreateRouteService { pub struct RouteService { service: BoxedRouteService, - guards: Rc>>, + guards: Rc>>, } impl RouteService { diff --git a/src/scope.rs b/src/scope.rs index 714f0354a..760fee478 100644 --- a/src/scope.rs +++ b/src/scope.rs @@ -23,7 +23,7 @@ use crate::service::{ ServiceFactory, ServiceFactoryWrapper, ServiceRequest, ServiceResponse, }; -type Guards = Vec>; +type Guards = Vec>; type HttpService = BoxedService; type HttpNewService = BoxedNewService<(), ServiceRequest, ServiceResponse, Error, ()>; type BoxedResponse = Either< @@ -64,8 +64,8 @@ pub struct Scope { endpoint: T, rdef: String, data: Option, - services: Vec>, - guards: Vec>, + services: Vec>, + guards: Vec>, default: Rc>>>, external: Vec, factory_ref: Rc>>, @@ -578,7 +578,7 @@ impl Future for ScopeFactoryResponse { pub struct ScopeService { data: Option>, - router: Router>>, + router: Router>>, default: Option, _ready: Option<(ServiceRequest, ResourceInfo)>, } diff --git a/src/service.rs b/src/service.rs index 5863a100e..1d475cf15 100644 --- a/src/service.rs +++ b/src/service.rs @@ -407,7 +407,7 @@ impl fmt::Debug for ServiceResponse { pub struct WebService { rdef: String, name: Option, - guards: Vec>, + guards: Vec>, } impl WebService { @@ -476,7 +476,7 @@ struct WebServiceImpl { srv: T, rdef: String, name: Option, - guards: Vec>, + guards: Vec>, } impl HttpServiceFactory for WebServiceImpl diff --git a/src/types/form.rs b/src/types/form.rs index e61145b0d..42e6363f1 100644 --- a/src/types/form.rs +++ b/src/types/form.rs @@ -141,7 +141,7 @@ impl fmt::Display for Form { #[derive(Clone)] pub struct FormConfig { limit: usize, - ehandler: Option Error>>, + ehandler: Option Error>>, } impl FormConfig { diff --git a/src/types/path.rs b/src/types/path.rs index 2a6ce2879..a46575764 100644 --- a/src/types/path.rs +++ b/src/types/path.rs @@ -224,7 +224,7 @@ where /// ``` #[derive(Clone)] pub struct PathConfig { - ehandler: Option Error + Send + Sync>>, + ehandler: Option Error + Send + Sync>>, } impl PathConfig { diff --git a/src/types/payload.rs b/src/types/payload.rs index 8a634b4c9..f33e2e5f1 100644 --- a/src/types/payload.rs +++ b/src/types/payload.rs @@ -128,7 +128,7 @@ impl FromRequest for Bytes { #[inline] fn from_request(req: &HttpRequest, payload: &mut dev::Payload) -> Self::Future { - let mut tmp; + let tmp; let cfg = if let Some(cfg) = req.app_data::() { cfg } else { @@ -184,7 +184,7 @@ impl FromRequest for String { #[inline] fn from_request(req: &HttpRequest, payload: &mut dev::Payload) -> Self::Future { - let mut tmp; + let tmp; let cfg = if let Some(cfg) = req.app_data::() { cfg } else { diff --git a/src/types/query.rs b/src/types/query.rs index 17240c0b5..2ad7106d0 100644 --- a/src/types/query.rs +++ b/src/types/query.rs @@ -192,7 +192,8 @@ where /// ``` #[derive(Clone)] pub struct QueryConfig { - ehandler: Option Error + Send + Sync>>, + ehandler: + Option Error + Send + Sync>>, } impl QueryConfig {