cargo fmt

This commit is contained in:
Jon Gjengset 2019-09-11 10:30:41 -04:00
parent 87976ae418
commit 4c1df65a75
No known key found for this signature in database
GPG Key ID: FAEA8B761ADA5F4C
2 changed files with 31 additions and 24 deletions

View File

@ -62,9 +62,7 @@ where
Ok(Err(e)) => return Poll::Ready(Err(e.into())), Ok(Err(e)) => return Poll::Ready(Err(e.into())),
Err(_) => return Poll::Ready(Err(Closed::new().into())), Err(_) => return Poll::Ready(Err(Closed::new().into())),
}, },
ResponseState::Poll(fut) => { ResponseState::Poll(fut) => return fut.poll(cx).map_err(Into::into),
return fut.poll(cx).map_err(Into::into)
}
} }
} }
} }

View File

@ -1,12 +1,15 @@
use futures_util::{
future::{poll_fn, Ready},
pin_mut,
};
use std::time::Duration; use std::time::Duration;
use futures_util::{pin_mut, future::{Ready, poll_fn}};
use tower::builder::ServiceBuilder; use tower::builder::ServiceBuilder;
use tower::util::ServiceExt; use tower::util::ServiceExt;
use tower_buffer::BufferLayer; use tower_buffer::BufferLayer;
use tower_limit::{concurrency::ConcurrencyLimitLayer, rate::RateLimitLayer}; use tower_limit::{concurrency::ConcurrencyLimitLayer, rate::RateLimitLayer};
use tower_retry::{Policy, RetryLayer}; use tower_retry::{Policy, RetryLayer};
use tower_service::*; use tower_service::*;
use tower_test::{mock}; use tower_test::mock;
#[tokio::test] #[tokio::test]
async fn builder_service() { async fn builder_service() {
@ -27,7 +30,9 @@ async fn builder_service() {
let mut client = client.ready().await.unwrap(); let mut client = client.ready().await.unwrap();
let fut = client.call("hello"); let fut = client.call("hello");
let (request, rsp) = poll_fn(|cx| handle.as_mut().poll_request(cx)).await.unwrap(); let (request, rsp) = poll_fn(|cx| handle.as_mut().poll_request(cx))
.await
.unwrap();
assert_eq!(request, "hello"); assert_eq!(request, "hello");
rsp.send_response("world"); rsp.send_response("world");
assert_eq!(fut.await.unwrap(), "world"); assert_eq!(fut.await.unwrap(), "world");
@ -42,7 +47,11 @@ where
{ {
type Future = Ready<Self>; type Future = Ready<Self>;
fn retry(&self, _req: &&'static str, _result: Result<&&'static str, &E>) -> Option<Self::Future> { fn retry(
&self,
_req: &&'static str,
_result: Result<&&'static str, &E>,
) -> Option<Self::Future> {
None None
} }