mirror of https://github.com/fafhrd91/actix-net
Fix clippy
This commit is contained in:
parent
93889776c4
commit
7afda5cab1
|
@ -333,7 +333,7 @@ impl Future for CleanupPending {
|
||||||
let mut pending = cell.borrow_mut();
|
let mut pending = cell.borrow_mut();
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
while i != pending.len() {
|
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);
|
pending.remove(i);
|
||||||
} else {
|
} else {
|
||||||
i += 1;
|
i += 1;
|
||||||
|
|
|
@ -286,7 +286,7 @@ impl ServerBuilder {
|
||||||
|
|
||||||
// handle signals
|
// handle signals
|
||||||
if !self.no_signals {
|
if !self.no_signals {
|
||||||
Signals::start(self.server.clone()).unwrap();
|
Signals::start(self.server.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
// start http server actor
|
// start http server actor
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::io;
|
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
|
|
||||||
|
#[cfg(not(unix))]
|
||||||
|
use std::io;
|
||||||
|
|
||||||
use futures_util::future::lazy;
|
use futures_util::future::lazy;
|
||||||
|
|
||||||
use crate::server::Server;
|
use crate::server::Server;
|
||||||
|
@ -30,7 +32,7 @@ pub(crate) struct Signals {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Signals {
|
impl Signals {
|
||||||
pub(crate) fn start(srv: Server) -> io::Result<()> {
|
pub(crate) fn start(srv: Server) {
|
||||||
actix_rt::spawn(lazy(|_| {
|
actix_rt::spawn(lazy(|_| {
|
||||||
#[cfg(not(unix))]
|
#[cfg(not(unix))]
|
||||||
{
|
{
|
||||||
|
@ -66,8 +68,6 @@ impl Signals {
|
||||||
actix_rt::spawn(Signals { srv, streams })
|
actix_rt::spawn(Signals { srv, streams })
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -290,11 +290,9 @@ where
|
||||||
}
|
}
|
||||||
State::Error(_) => {
|
State::Error(_) => {
|
||||||
// flush write buffer
|
// flush write buffer
|
||||||
if !this.framed.is_write_buf_empty() {
|
if !this.framed.is_write_buf_empty() && this.framed.flush(cx).is_pending() {
|
||||||
if let Poll::Pending = this.framed.flush(cx) {
|
|
||||||
return Poll::Pending;
|
return Poll::Pending;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Poll::Ready(Err(this.state.take_error()))
|
Poll::Ready(Err(this.state.take_error()))
|
||||||
}
|
}
|
||||||
State::FlushAndStop => {
|
State::FlushAndStop => {
|
||||||
|
|
|
@ -74,7 +74,7 @@ where
|
||||||
type Future = InFlightServiceResponse<T>;
|
type Future = InFlightServiceResponse<T>;
|
||||||
|
|
||||||
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
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
|
Poll::Pending
|
||||||
} else if !self.count.available(cx) {
|
} else if !self.count.available(cx) {
|
||||||
log::trace!("InFlight limit exceeded");
|
log::trace!("InFlight limit exceeded");
|
||||||
|
|
|
@ -160,7 +160,12 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
// check nested service
|
// 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
|
Poll::Pending
|
||||||
} else {
|
} else {
|
||||||
Poll::Ready(Ok(()))
|
Poll::Ready(Ok(()))
|
||||||
|
|
Loading…
Reference in New Issue