From 12e874cef0e3dc8fd158a9e26acf94ddde7afaf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Mon, 25 Jan 2021 14:42:49 +0100 Subject: [PATCH] allow complex Futures in tower_service impl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabian Grünbichler --- src/server/h2service.rs | 5 +++-- src/server/rest.rs | 3 ++- src/tools/http.rs | 5 ++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/server/h2service.rs b/src/server/h2service.rs index 989618ec..332b3b1a 100644 --- a/src/server/h2service.rs +++ b/src/server/h2service.rs @@ -1,6 +1,7 @@ use anyhow::{Error}; use std::collections::HashMap; +use std::pin::Pin; use std::sync::Arc; use std::task::{Context, Poll}; @@ -85,8 +86,8 @@ impl H2Service { impl tower_service::Service> for H2Service { type Response = Response; type Error = Error; - type Future = - std::pin::Pin, Self::Error>> + Send>>; + #[allow(clippy::type_complexity)] + type Future = Pin> + Send>>; fn poll_ready(&mut self, _cx: &mut Context) -> Poll> { Poll::Ready(Ok(())) diff --git a/src/server/rest.rs b/src/server/rest.rs index 0586979a..fc59be9a 100644 --- a/src/server/rest.rs +++ b/src/server/rest.rs @@ -198,7 +198,8 @@ fn get_user_agent(headers: &HeaderMap) -> Option { impl tower_service::Service> for ApiService { type Response = Response; type Error = Error; - type Future = Pin, Self::Error>> + Send>>; + #[allow(clippy::type_complexity)] + type Future = Pin> + Send>>; fn poll_ready(&mut self, _cx: &mut Context) -> Poll> { Poll::Ready(Ok(())) diff --git a/src/tools/http.rs b/src/tools/http.rs index 47d6e1f6..0fbc85fb 100644 --- a/src/tools/http.rs +++ b/src/tools/http.rs @@ -108,9 +108,8 @@ type MaybeTlsStream = EitherStream< impl hyper::service::Service for HttpsConnector { type Response = MaybeTlsStream; type Error = Error; - type Future = std::pin::Pin> + Send + 'static - >>; + #[allow(clippy::type_complexity)] + type Future = Pin> + Send + 'static>>; fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll> { // This connector is always ready, but others might not be.