style(lib): run rustfmt and enforce in CI
This commit is contained in:
		| @@ -2,12 +2,16 @@ | ||||
| //! | ||||
| //! This module provides `Connect` which hook-ins into the Tower ecosystem. | ||||
|  | ||||
| use std::marker::PhantomData; | ||||
| use std::future::Future; | ||||
| use std::error::Error as StdError; | ||||
| use std::future::Future; | ||||
| use std::marker::PhantomData; | ||||
|  | ||||
| use crate::{common::{Poll, task, Pin}, body::Payload, service::{MakeConnection, Service}}; | ||||
| use super::conn::{SendRequest, Builder}; | ||||
| use super::conn::{Builder, SendRequest}; | ||||
| use crate::{ | ||||
|     body::Payload, | ||||
|     common::{task, Pin, Poll}, | ||||
|     service::{MakeConnection, Service}, | ||||
| }; | ||||
|  | ||||
| /// Creates a connection via `SendRequest`. | ||||
| /// | ||||
| @@ -18,7 +22,7 @@ use super::conn::{SendRequest, Builder}; | ||||
| pub struct Connect<C, B, T> { | ||||
|     inner: C, | ||||
|     builder: Builder, | ||||
|     _pd: PhantomData<fn(T, B)> | ||||
|     _pd: PhantomData<fn(T, B)>, | ||||
| } | ||||
|  | ||||
| impl<C, B, T> Connect<C, B, T> { | ||||
| @@ -28,7 +32,7 @@ impl<C, B, T> Connect<C, B, T> { | ||||
|         Self { | ||||
|             inner, | ||||
|             builder, | ||||
|             _pd: PhantomData | ||||
|             _pd: PhantomData, | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -44,10 +48,13 @@ where | ||||
| { | ||||
|     type Response = SendRequest<B>; | ||||
|     type Error = crate::Error; | ||||
|     type Future = Pin<Box<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, cx: &mut task::Context<'_>) -> Poll<Result<(), Self::Error>> { | ||||
|         self.inner.poll_ready(cx).map_err(|e| crate::Error::new(crate::error::Kind::Connect).with(e.into())) | ||||
|         self.inner | ||||
|             .poll_ready(cx) | ||||
|             .map_err(|e| crate::Error::new(crate::error::Kind::Connect).with(e.into())) | ||||
|     } | ||||
|  | ||||
|     fn call(&mut self, req: T) -> Self::Future { | ||||
| @@ -56,18 +63,16 @@ where | ||||
|  | ||||
|         let fut = async move { | ||||
|             match io.await { | ||||
|                 Ok(io) => { | ||||
|                     match builder.handshake(io).await { | ||||
|                         Ok((sr, conn)) => { | ||||
|                             builder.exec.execute(async move { | ||||
|                                 if let Err(e) = conn.await { | ||||
|                                     debug!("connection error: {:?}", e); | ||||
|                                 } | ||||
|                             }); | ||||
|                             Ok(sr) | ||||
|                         }, | ||||
|                         Err(e) => Err(e) | ||||
|                 Ok(io) => match builder.handshake(io).await { | ||||
|                     Ok((sr, conn)) => { | ||||
|                         builder.exec.execute(async move { | ||||
|                             if let Err(e) = conn.await { | ||||
|                                 debug!("connection error: {:?}", e); | ||||
|                             } | ||||
|                         }); | ||||
|                         Ok(sr) | ||||
|                     } | ||||
|                     Err(e) => Err(e), | ||||
|                 }, | ||||
|                 Err(e) => { | ||||
|                     let err = crate::Error::new(crate::error::Kind::Connect).with(e.into()); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user