Minor opti poll Fuse (#946)

This commit is contained in:
Pierre Krieger
2019-02-18 11:24:01 +01:00
committed by GitHub
parent 965c154093
commit 2d31c2f733

View File

@ -146,16 +146,15 @@ where
ProtocolsHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::OutEvent>,
Self::Error,
> {
if let Some(mut inner) = self.inner.take() {
let poll = inner.poll();
if let Ok(Async::Ready(ProtocolsHandlerEvent::Shutdown)) = poll {
poll
} else {
self.inner = Some(inner);
poll
}
} else {
Ok(Async::Ready(ProtocolsHandlerEvent::Shutdown))
let poll = match self.inner.as_mut() {
Some(i) => i.poll(),
None => return Ok(Async::Ready(ProtocolsHandlerEvent::Shutdown)),
};
if let Ok(Async::Ready(ProtocolsHandlerEvent::Shutdown)) = poll {
self.inner = None;
}
poll
}
}