Fix clippy

This commit is contained in:
Juan Aguilar Santillana 2020-12-12 20:19:13 +01:00
parent 93889776c4
commit 7afda5cab1
6 changed files with 15 additions and 12 deletions

View File

@ -333,7 +333,7 @@ impl Future for CleanupPending {
let mut pending = cell.borrow_mut();
let mut i = 0;
while i != pending.len() {
if let Poll::Ready(_) = Pin::new(&mut pending[i]).poll(cx) {
if Pin::new(&mut pending[i]).poll(cx).is_ready() {
pending.remove(i);
} else {
i += 1;

View File

@ -286,7 +286,7 @@ impl ServerBuilder {
// handle signals
if !self.no_signals {
Signals::start(self.server.clone()).unwrap();
Signals::start(self.server.clone());
}
// start http server actor

View File

@ -1,8 +1,10 @@
use std::future::Future;
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
#[cfg(not(unix))]
use std::io;
use futures_util::future::lazy;
use crate::server::Server;
@ -30,7 +32,7 @@ pub(crate) struct Signals {
}
impl Signals {
pub(crate) fn start(srv: Server) -> io::Result<()> {
pub(crate) fn start(srv: Server) {
actix_rt::spawn(lazy(|_| {
#[cfg(not(unix))]
{
@ -66,8 +68,6 @@ impl Signals {
actix_rt::spawn(Signals { srv, streams })
}
}));
Ok(())
}
}

View File

@ -290,10 +290,8 @@ where
}
State::Error(_) => {
// flush write buffer
if !this.framed.is_write_buf_empty() {
if let Poll::Pending = this.framed.flush(cx) {
return Poll::Pending;
}
if !this.framed.is_write_buf_empty() && this.framed.flush(cx).is_pending() {
return Poll::Pending;
}
Poll::Ready(Err(this.state.take_error()))
}

View File

@ -74,7 +74,7 @@ where
type Future = InFlightServiceResponse<T>;
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
if let Poll::Pending = self.service.poll_ready(cx)? {
if self.service.poll_ready(cx)?.is_pending() {
Poll::Pending
} else if !self.count.available(cx) {
log::trace!("InFlight limit exceeded");

View File

@ -160,7 +160,12 @@ where
}
// check nested service
if let Poll::Pending = self.service.poll_ready(cx).map_err(InOrderError::Service)? {
if self
.service
.poll_ready(cx)
.map_err(InOrderError::Service)?
.is_pending()
{
Poll::Pending
} else {
Poll::Ready(Ok(()))