Skip to content

Commit dde38bb

Browse files
authored
remove unnecessary Pin in poll_recv calls (#475)
1 parent d973d59 commit dde38bb

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

actix-rt/src/arbiter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl Future for ArbiterRunner {
303303
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
304304
// process all items currently buffered in channel
305305
loop {
306-
match ready!(Pin::new(&mut self.rx).poll_recv(cx)) {
306+
match ready!(self.rx.poll_recv(cx)) {
307307
// channel closed; no more messages can be received
308308
None => return Poll::Ready(()),
309309

actix-rt/src/system.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ impl Future for SystemController {
292292
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
293293
// process all items currently buffered in channel
294294
loop {
295-
match ready!(Pin::new(&mut self.cmd_rx).poll_recv(cx)) {
295+
match ready!(self.cmd_rx.poll_recv(cx)) {
296296
// channel closed; no more messages can be received
297297
None => return Poll::Ready(()),
298298

actix-server/src/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,6 @@ impl Stream for ServerEventMultiplexer {
363363
}
364364
}
365365

366-
Pin::new(&mut this.cmd_rx).poll_recv(cx)
366+
this.cmd_rx.poll_recv(cx)
367367
}
368368
}

actix-server/src/signals.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl Future for Signals {
9696
#[cfg(unix)]
9797
{
9898
for (sig, fut) in self.signals.iter_mut() {
99-
if Pin::new(fut).poll_recv(cx).is_ready() {
99+
if fut.poll_recv(cx).is_ready() {
100100
trace!("{} received", sig);
101101
return Poll::Ready(*sig);
102102
}

actix-server/src/worker.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -585,9 +585,7 @@ impl Future for ServerWorker {
585585
let this = self.as_mut().get_mut();
586586

587587
// `StopWorker` message handler
588-
if let Poll::Ready(Some(Stop { graceful, tx })) =
589-
Pin::new(&mut this.stop_rx).poll_recv(cx)
590-
{
588+
if let Poll::Ready(Some(Stop { graceful, tx })) = this.stop_rx.poll_recv(cx) {
591589
let num = this.counter.total();
592590
if num == 0 {
593591
info!("shutting down idle worker");
@@ -649,7 +647,7 @@ impl Future for ServerWorker {
649647
}
650648
WorkerState::Shutdown(ref mut shutdown) => {
651649
// drop all pending connections in rx channel.
652-
while let Poll::Ready(Some(conn)) = Pin::new(&mut this.conn_rx).poll_recv(cx) {
650+
while let Poll::Ready(Some(conn)) = this.conn_rx.poll_recv(cx) {
653651
// WorkerCounterGuard is needed as Accept thread has incremented counter.
654652
// It's guard's job to decrement the counter together with drop of Conn.
655653
let guard = this.counter.guard();
@@ -696,7 +694,7 @@ impl Future for ServerWorker {
696694
}
697695

698696
// handle incoming io stream
699-
match ready!(Pin::new(&mut this.conn_rx).poll_recv(cx)) {
697+
match ready!(this.conn_rx.poll_recv(cx)) {
700698
Some(msg) => {
701699
let guard = this.counter.guard();
702700
let _ = this.services[msg.token].service.call((guard, msg.io));

0 commit comments

Comments
 (0)