diff --git a/Cargo.toml b/Cargo.toml index 441291d3b..e04b2974b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -139,4 +139,4 @@ actix-server = { git = "https://github.com/actix/actix-net.git" } actix-service = { git = "https://github.com/actix/actix-net.git" } actix-testing = { git = "https://github.com/actix/actix-net.git" } actix-tls = { git = "https://github.com/actix/actix-net.git" } -actix-utils = { git = "https://github.com/actix/actix-net.git" } +actix-utils = { git = "https://github.com/actix/actix-net.git" } diff --git a/actix-files/src/lib.rs b/actix-files/src/lib.rs index ed8b6c3b9..94bb0e376 100644 --- a/actix-files/src/lib.rs +++ b/actix-files/src/lib.rs @@ -415,7 +415,7 @@ impl ServiceFactory for Files { type InitError = (); type Future = LocalBoxFuture<'static, Result>; - fn new_service(&self, _: &()) -> Self::Future { + fn new_service(&self, _: ()) -> Self::Future { let mut srv = FilesService { directory: self.directory.clone(), index: self.index.clone(), @@ -430,7 +430,7 @@ impl ServiceFactory for Files { if let Some(ref default) = *self.default.borrow() { default - .new_service(&()) + .new_service(()) .map(move |result| match result { Ok(default) => { srv.default = Some(default); @@ -1262,7 +1262,7 @@ mod tests { .default_handler(|req: ServiceRequest| { ok(req.into_response(HttpResponse::Ok().body("default content"))) }) - .new_service(&()) + .new_service(()) .await .unwrap(); let req = TestRequest::with_uri("/missing").to_srv_request(); diff --git a/actix-framed/src/app.rs b/actix-framed/src/app.rs index 2f8c800f8..e4b91e6c4 100644 --- a/actix-framed/src/app.rs +++ b/actix-framed/src/app.rs @@ -104,7 +104,7 @@ where type Service = FramedAppService; type Future = CreateService; - fn new_service(&self, _: &()) -> Self::Future { + fn new_service(&self, _: ()) -> Self::Future { CreateService { fut: self .services @@ -112,7 +112,7 @@ where .map(|(path, service)| { CreateServiceItem::Future( Some(path.clone()), - service.new_service(&()), + service.new_service(()), ) }) .collect(), diff --git a/actix-framed/src/helpers.rs b/actix-framed/src/helpers.rs index b654f9cd7..d08ca25ac 100644 --- a/actix-framed/src/helpers.rs +++ b/actix-framed/src/helpers.rs @@ -56,8 +56,8 @@ where type Service = BoxedHttpService; type Future = LocalBoxFuture<'static, Result>; - fn new_service(&self, _: &()) -> Self::Future { - let fut = self.0.new_service(&()); + fn new_service(&self, _: ()) -> Self::Future { + let fut = self.0.new_service(()); async move { fut.await.map_err(|_| ()).map(|service| { diff --git a/actix-framed/src/route.rs b/actix-framed/src/route.rs index 783039684..03e48e4d2 100644 --- a/actix-framed/src/route.rs +++ b/actix-framed/src/route.rs @@ -113,7 +113,7 @@ where type Service = FramedRouteService; type Future = Ready>; - fn new_service(&self, _: &()) -> Self::Future { + fn new_service(&self, _: ()) -> Self::Future { ok(FramedRouteService { handler: self.handler.clone(), methods: self.methods.clone(), diff --git a/actix-framed/src/service.rs b/actix-framed/src/service.rs index ed3a75ff5..92393ca75 100644 --- a/actix-framed/src/service.rs +++ b/actix-framed/src/service.rs @@ -33,7 +33,7 @@ impl ServiceFactory for VerifyWebSockets { type Service = VerifyWebSockets; type Future = Ready>; - fn new_service(&self, _: &C) -> Self::Future { + fn new_service(&self, _: C) -> Self::Future { ok(VerifyWebSockets { _t: PhantomData }) } } @@ -83,7 +83,7 @@ where type Service = SendError; type Future = Ready>; - fn new_service(&self, _: &C) -> Self::Future { + fn new_service(&self, _: C) -> Self::Future { ok(SendError(PhantomData)) } } diff --git a/actix-http/src/h1/expect.rs b/actix-http/src/h1/expect.rs index 576b7672e..109491bac 100644 --- a/actix-http/src/h1/expect.rs +++ b/actix-http/src/h1/expect.rs @@ -17,7 +17,7 @@ impl ServiceFactory for ExpectHandler { type InitError = Error; type Future = Ready>; - fn new_service(&self, _: &()) -> Self::Future { + fn new_service(&self, _: ()) -> Self::Future { ok(ExpectHandler) } } diff --git a/actix-http/src/h1/service.rs b/actix-http/src/h1/service.rs index abc96e719..354fed482 100644 --- a/actix-http/src/h1/service.rs +++ b/actix-http/src/h1/service.rs @@ -217,11 +217,11 @@ where type Service = H1ServiceHandler; type Future = H1ServiceResponse; - fn new_service(&self, cfg: &()) -> Self::Future { + fn new_service(&self, _: ()) -> Self::Future { H1ServiceResponse { - fut: self.srv.new_service(cfg), - fut_ex: Some(self.expect.new_service(cfg)), - fut_upg: self.upgrade.as_ref().map(|f| f.new_service(cfg)), + fut: self.srv.new_service(()), + fut_ex: Some(self.expect.new_service(())), + fut_upg: self.upgrade.as_ref().map(|f| f.new_service(())), expect: None, upgrade: None, on_connect: self.on_connect.clone(), @@ -450,7 +450,7 @@ where type Service = OneRequestService; type Future = Ready>; - fn new_service(&self, _: &()) -> Self::Future { + fn new_service(&self, _: ()) -> Self::Future { ok(OneRequestService { _t: PhantomData, config: self.config.clone(), diff --git a/actix-http/src/h1/upgrade.rs b/actix-http/src/h1/upgrade.rs index e84230ac7..e3ce66521 100644 --- a/actix-http/src/h1/upgrade.rs +++ b/actix-http/src/h1/upgrade.rs @@ -20,7 +20,7 @@ impl ServiceFactory for UpgradeHandler { type InitError = Error; type Future = Ready>; - fn new_service(&self, _: &()) -> Self::Future { + fn new_service(&self, _: ()) -> Self::Future { unimplemented!() } } diff --git a/actix-http/src/h2/service.rs b/actix-http/src/h2/service.rs index a2c8275a1..864070eb3 100644 --- a/actix-http/src/h2/service.rs +++ b/actix-http/src/h2/service.rs @@ -160,9 +160,9 @@ where type Service = H2ServiceHandler; type Future = H2ServiceResponse; - fn new_service(&self, cfg: &()) -> Self::Future { + fn new_service(&self, _: ()) -> Self::Future { H2ServiceResponse { - fut: self.srv.new_service(cfg), + fut: self.srv.new_service(()), cfg: Some(self.cfg.clone()), on_connect: self.on_connect.clone(), _t: PhantomData, diff --git a/actix-http/src/service.rs b/actix-http/src/service.rs index 8220421ab..de5fd0c55 100644 --- a/actix-http/src/service.rs +++ b/actix-http/src/service.rs @@ -282,11 +282,11 @@ where type Service = HttpServiceHandler; type Future = HttpServiceResponse; - fn new_service(&self, cfg: &()) -> Self::Future { + fn new_service(&self, _: ()) -> Self::Future { HttpServiceResponse { - fut: self.srv.new_service(cfg), - fut_ex: Some(self.expect.new_service(cfg)), - fut_upg: self.upgrade.as_ref().map(|f| f.new_service(cfg)), + fut: self.srv.new_service(()), + fut_ex: Some(self.expect.new_service(())), + fut_upg: self.upgrade.as_ref().map(|f| f.new_service(())), expect: None, upgrade: None, on_connect: self.on_connect.clone(), diff --git a/src/app_service.rs b/src/app_service.rs index 6c18cd542..6a91fa079 100644 --- a/src/app_service.rs +++ b/src/app_service.rs @@ -66,7 +66,7 @@ where type Service = AppInitService; type Future = AppInitResult; - fn new_service(&self, _: &()) -> Self::Future { + fn new_service(&self, _: ()) -> Self::Future { // update resource default service let default = self.default.clone().unwrap_or_else(|| { Rc::new(boxed::factory(service_fn(|req: ServiceRequest| { @@ -115,7 +115,7 @@ where AppInitResult { endpoint: None, - endpoint_fut: self.endpoint.new_service(&()), + endpoint_fut: self.endpoint.new_service(()), data: self.data.clone(), data_factories: Vec::new(), data_factories_fut: self.data_factories.iter().map(|f| f()).collect(), @@ -273,7 +273,7 @@ impl ServiceFactory for AppRoutingFactory { type Service = AppRouting; type Future = AppRoutingFactoryResponse; - fn new_service(&self, _: &()) -> Self::Future { + fn new_service(&self, _: ()) -> Self::Future { AppRoutingFactoryResponse { fut: self .services @@ -282,12 +282,12 @@ impl ServiceFactory for AppRoutingFactory { CreateAppRoutingItem::Future( Some(path.clone()), guards.borrow_mut().take(), - service.new_service(&()).boxed_local(), + service.new_service(()).boxed_local(), ) }) .collect(), default: None, - default_fut: Some(self.default.new_service(&())), + default_fut: Some(self.default.new_service(())), } } } @@ -432,8 +432,8 @@ impl ServiceFactory for AppEntry { type Service = AppRouting; type Future = AppRoutingFactoryResponse; - fn new_service(&self, _: &()) -> Self::Future { - self.factory.borrow_mut().as_mut().unwrap().new_service(&()) + fn new_service(&self, _: ()) -> Self::Future { + self.factory.borrow_mut().as_mut().unwrap().new_service(()) } } diff --git a/src/handler.rs b/src/handler.rs index a7023422b..d1b070d88 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -177,7 +177,7 @@ where type Service = ExtractService; type Future = Ready>; - fn new_service(&self, _: &()) -> Self::Future { + fn new_service(&self, _: ()) -> Self::Future { ok(ExtractService { _t: PhantomData, service: self.service.clone(), diff --git a/src/resource.rs b/src/resource.rs index 866cbecf5..7ee0506a3 100644 --- a/src/resource.rs +++ b/src/resource.rs @@ -435,9 +435,9 @@ impl ServiceFactory for ResourceFactory { type Service = ResourceService; type Future = CreateResourceService; - fn new_service(&self, _: &()) -> Self::Future { + fn new_service(&self, _: ()) -> Self::Future { let default_fut = if let Some(ref default) = *self.default.borrow() { - Some(default.new_service(&())) + Some(default.new_service(())) } else { None }; @@ -446,7 +446,7 @@ impl ServiceFactory for ResourceFactory { fut: self .routes .iter() - .map(|route| CreateRouteServiceItem::Future(route.new_service(&()))) + .map(|route| CreateRouteServiceItem::Future(route.new_service(()))) .collect(), data: self.data.clone(), default: None, @@ -575,8 +575,8 @@ impl ServiceFactory for ResourceEndpoint { type Service = ResourceService; type Future = CreateResourceService; - fn new_service(&self, _: &()) -> Self::Future { - self.factory.borrow_mut().as_mut().unwrap().new_service(&()) + fn new_service(&self, _: ()) -> Self::Future { + self.factory.borrow_mut().as_mut().unwrap().new_service(()) } } diff --git a/src/route.rs b/src/route.rs index 93f88bfe2..2c643099b 100644 --- a/src/route.rs +++ b/src/route.rs @@ -69,9 +69,9 @@ impl ServiceFactory for Route { type Service = RouteService; type Future = CreateRouteService; - fn new_service(&self, _: &()) -> Self::Future { + fn new_service(&self, _: ()) -> Self::Future { CreateRouteService { - fut: self.service.new_service(&()), + fut: self.service.new_service(()), guards: self.guards.clone(), } } @@ -280,9 +280,9 @@ where type Service = BoxedRouteService; type Future = LocalBoxFuture<'static, Result>; - fn new_service(&self, _: &()) -> Self::Future { + fn new_service(&self, _: ()) -> Self::Future { self.service - .new_service(&()) + .new_service(()) .map(|result| match result { Ok(service) => { let service: BoxedRouteService<_, _> = diff --git a/src/scope.rs b/src/scope.rs index db6f5da57..d6b88577b 100644 --- a/src/scope.rs +++ b/src/scope.rs @@ -488,9 +488,9 @@ impl ServiceFactory for ScopeFactory { type Service = ScopeService; type Future = ScopeFactoryResponse; - fn new_service(&self, _: &()) -> Self::Future { + fn new_service(&self, _: ()) -> Self::Future { let default_fut = if let Some(ref default) = *self.default.borrow() { - Some(default.new_service(&())) + Some(default.new_service(())) } else { None }; @@ -503,7 +503,7 @@ impl ServiceFactory for ScopeFactory { CreateScopeServiceItem::Future( Some(path.clone()), guards.borrow_mut().take(), - service.new_service(&()), + service.new_service(()), ) }) .collect(), @@ -656,8 +656,8 @@ impl ServiceFactory for ScopeEndpoint { type Service = ScopeService; type Future = ScopeFactoryResponse; - fn new_service(&self, _: &()) -> Self::Future { - self.factory.borrow_mut().as_mut().unwrap().new_service(&()) + fn new_service(&self, _: ()) -> Self::Future { + self.factory.borrow_mut().as_mut().unwrap().new_service(()) } } diff --git a/src/test.rs b/src/test.rs index 9ded3f9f8..a33374800 100644 --- a/src/test.rs +++ b/src/test.rs @@ -78,7 +78,7 @@ where S::InitError: std::fmt::Debug, { let srv = app.into_factory(); - srv.new_service(&()).await.unwrap() + srv.new_service(()).await.unwrap() } /// Calls service and waits for response future completion.