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

remove unnecessary Pin in poll_recv calls (#475)

This commit is contained in:
Juan Aguilar Santillana 2023-01-02 14:36:46 +01:00 committed by GitHub
parent d973d5974a
commit dde38bbe06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 9 deletions

View File

@ -303,7 +303,7 @@ impl Future for ArbiterRunner {
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
// process all items currently buffered in channel
loop {
match ready!(Pin::new(&mut self.rx).poll_recv(cx)) {
match ready!(self.rx.poll_recv(cx)) {
// channel closed; no more messages can be received
None => return Poll::Ready(()),

View File

@ -292,7 +292,7 @@ impl Future for SystemController {
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
// process all items currently buffered in channel
loop {
match ready!(Pin::new(&mut self.cmd_rx).poll_recv(cx)) {
match ready!(self.cmd_rx.poll_recv(cx)) {
// channel closed; no more messages can be received
None => return Poll::Ready(()),

View File

@ -363,6 +363,6 @@ impl Stream for ServerEventMultiplexer {
}
}
Pin::new(&mut this.cmd_rx).poll_recv(cx)
this.cmd_rx.poll_recv(cx)
}
}

View File

@ -96,7 +96,7 @@ impl Future for Signals {
#[cfg(unix)]
{
for (sig, fut) in self.signals.iter_mut() {
if Pin::new(fut).poll_recv(cx).is_ready() {
if fut.poll_recv(cx).is_ready() {
trace!("{} received", sig);
return Poll::Ready(*sig);
}

View File

@ -585,9 +585,7 @@ impl Future for ServerWorker {
let this = self.as_mut().get_mut();
// `StopWorker` message handler
if let Poll::Ready(Some(Stop { graceful, tx })) =
Pin::new(&mut this.stop_rx).poll_recv(cx)
{
if let Poll::Ready(Some(Stop { graceful, tx })) = this.stop_rx.poll_recv(cx) {
let num = this.counter.total();
if num == 0 {
info!("shutting down idle worker");
@ -649,7 +647,7 @@ impl Future for ServerWorker {
}
WorkerState::Shutdown(ref mut shutdown) => {
// drop all pending connections in rx channel.
while let Poll::Ready(Some(conn)) = Pin::new(&mut this.conn_rx).poll_recv(cx) {
while let Poll::Ready(Some(conn)) = this.conn_rx.poll_recv(cx) {
// WorkerCounterGuard is needed as Accept thread has incremented counter.
// It's guard's job to decrement the counter together with drop of Conn.
let guard = this.counter.guard();
@ -696,7 +694,7 @@ impl Future for ServerWorker {
}
// handle incoming io stream
match ready!(Pin::new(&mut this.conn_rx).poll_recv(cx)) {
match ready!(this.conn_rx.poll_recv(cx)) {
Some(msg) => {
let guard = this.counter.guard();
let _ = this.services[msg.token].service.call((guard, msg.io));