1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-27 18:02:58 +01:00

clippy warnings

This commit is contained in:
Nikolay Kim 2019-02-04 11:04:10 -08:00
parent 7dca264546
commit 08bc328826
8 changed files with 21 additions and 8 deletions

View File

@ -108,7 +108,7 @@ where
fn poll(&mut self) -> Poll<Self::Item, Self::Error> { fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
if let Some(ref mut fut) = self.fut_t { if let Some(ref mut fut) = self.fut_t {
return fut.poll().map_err(|e| e.into()); return fut.poll();
} }
match self.fut_a.as_mut().expect("Bug in actix-service").poll() { match self.fut_a.as_mut().expect("Bug in actix-service").poll() {

View File

@ -72,7 +72,7 @@ where
fn poll_ready(&mut self) -> Poll<(), Self::Error> { fn poll_ready(&mut self) -> Poll<(), Self::Error> {
try_ready!(self.a.poll_ready()); try_ready!(self.a.poll_ready());
self.b.get_mut().poll_ready().map_err(|e| e.into()) self.b.get_mut().poll_ready()
} }
fn call(&mut self, req: A::Request) -> Self::Future { fn call(&mut self, req: A::Request) -> Self::Future {
@ -123,7 +123,7 @@ where
self.poll() self.poll()
} }
Ok(Async::NotReady) => Ok(Async::NotReady), Ok(Async::NotReady) => Ok(Async::NotReady),
Err(err) => Err(err.into()), Err(err) => Err(err),
} }
} }
} }

View File

@ -78,7 +78,7 @@ where
fn poll_ready(&mut self) -> Poll<(), Self::Error> { fn poll_ready(&mut self) -> Poll<(), Self::Error> {
try_ready!(self.service.poll_ready()); try_ready!(self.service.poll_ready());
self.transform.poll_ready().map_err(|e| e.into()) self.transform.poll_ready()
} }
fn call(&mut self, req: Self::Request) -> Self::Future { fn call(&mut self, req: Self::Request) -> Self::Future {

View File

@ -18,6 +18,7 @@ impl<R, E> Blank<R, E> {
} }
impl<R> Blank<R, ()> { impl<R> Blank<R, ()> {
#[allow(clippy::new_ret_no_self)]
pub fn new<E>() -> Blank<R, E> { pub fn new<E>() -> Blank<R, E> {
Blank { _t: PhantomData } Blank { _t: PhantomData }
} }

View File

@ -61,9 +61,9 @@ where
fn poll_ready(&mut self) -> Poll<(), Self::Error> { fn poll_ready(&mut self) -> Poll<(), Self::Error> {
if !self.count.available() { if !self.count.available() {
log::trace!("InFlight limit exceeded"); log::trace!("InFlight limit exceeded");
return Ok(Async::NotReady); Ok(Async::NotReady)
} else { } else {
return Ok(Async::Ready(())); Ok(Async::Ready(()))
} }
} }

View File

@ -112,7 +112,7 @@ where
} }
} }
Ok(Async::NotReady) => Ok(Async::Ready(())), Ok(Async::NotReady) => Ok(Async::Ready(())),
Err(_) => panic!(), Err(_e) => panic!(),
} }
} }

View File

@ -115,6 +115,18 @@ where
} }
} }
impl<S> Default for InOrderService<S>
where
S: Service,
S::Response: 'static,
S::Future: 'static,
S::Error: 'static,
{
fn default() -> Self {
Self::new()
}
}
impl<S> Transform<S> for InOrderService<S> impl<S> Transform<S> for InOrderService<S>
where where
S: Service, S: Service,

View File

@ -133,7 +133,7 @@ impl SystemTimeService {
/// Get current time. This function has to be called from /// Get current time. This function has to be called from
/// future's poll method, otherwise it panics. /// future's poll method, otherwise it panics.
pub fn now(&self) -> time::SystemTime { pub fn now(&self) -> time::SystemTime {
let cur = self.0.get_ref().current.clone(); let cur = self.0.get_ref().current;
if let Some(cur) = cur { if let Some(cur) = cur {
cur cur
} else { } else {