allow complex Futures in tower_service impl

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2021-01-25 14:42:49 +01:00 committed by Wolfgang Bumiller
parent 6d233161b0
commit 12e874cef0
3 changed files with 7 additions and 6 deletions

View File

@ -1,6 +1,7 @@
use anyhow::{Error}; use anyhow::{Error};
use std::collections::HashMap; use std::collections::HashMap;
use std::pin::Pin;
use std::sync::Arc; use std::sync::Arc;
use std::task::{Context, Poll}; use std::task::{Context, Poll};
@ -85,8 +86,8 @@ impl <E: RpcEnvironment + Clone> H2Service<E> {
impl <E: RpcEnvironment + Clone> tower_service::Service<Request<Body>> for H2Service<E> { impl <E: RpcEnvironment + Clone> tower_service::Service<Request<Body>> for H2Service<E> {
type Response = Response<Body>; type Response = Response<Body>;
type Error = Error; type Error = Error;
type Future = #[allow(clippy::type_complexity)]
std::pin::Pin<Box<dyn Future<Output = Result<Response<Body>, Self::Error>> + Send>>; type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send>>;
fn poll_ready(&mut self, _cx: &mut Context) -> Poll<Result<(), Self::Error>> { fn poll_ready(&mut self, _cx: &mut Context) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(())) Poll::Ready(Ok(()))

View File

@ -198,7 +198,8 @@ fn get_user_agent(headers: &HeaderMap) -> Option<String> {
impl tower_service::Service<Request<Body>> for ApiService { impl tower_service::Service<Request<Body>> for ApiService {
type Response = Response<Body>; type Response = Response<Body>;
type Error = Error; type Error = Error;
type Future = Pin<Box<dyn Future<Output = Result<Response<Body>, Self::Error>> + Send>>; #[allow(clippy::type_complexity)]
type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send>>;
fn poll_ready(&mut self, _cx: &mut Context) -> Poll<Result<(), Self::Error>> { fn poll_ready(&mut self, _cx: &mut Context) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(())) Poll::Ready(Ok(()))

View File

@ -108,9 +108,8 @@ type MaybeTlsStream = EitherStream<
impl hyper::service::Service<Uri> for HttpsConnector { impl hyper::service::Service<Uri> for HttpsConnector {
type Response = MaybeTlsStream; type Response = MaybeTlsStream;
type Error = Error; type Error = Error;
type Future = std::pin::Pin<Box< #[allow(clippy::type_complexity)]
dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'static type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'static>>;
>>;
fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> { fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
// This connector is always ready, but others might not be. // This connector is always ready, but others might not be.