Skip to content

Commit 3ebbf12

Browse files
Lucretieltaiki-e
authored andcommitted
Simplify Fuse::poll to use a match expression instead of return (#2694)
1 parent ec532df commit 3ebbf12

File tree

1 file changed

+5
-7
lines changed
  • futures-util/src/future/future

1 file changed

+5
-7
lines changed

futures-util/src/future/future/fuse.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use core::pin::Pin;
22
use futures_core::future::{FusedFuture, Future};
3-
use futures_core::ready;
43
use futures_core::task::{Context, Poll};
54
use pin_project_lite::pin_project;
65

@@ -81,13 +80,12 @@ impl<Fut: Future> Future for Fuse<Fut> {
8180
type Output = Fut::Output;
8281

8382
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Fut::Output> {
84-
Poll::Ready(match self.as_mut().project().inner.as_pin_mut() {
85-
Some(fut) => {
86-
let output = ready!(fut.poll(cx));
83+
match self.as_mut().project().inner.as_pin_mut() {
84+
Some(fut) => fut.poll(cx).map(|output| {
8785
self.project().inner.set(None);
8886
output
89-
}
90-
None => return Poll::Pending,
91-
})
87+
}),
88+
None => Poll::Pending,
89+
}
9290
}
9391
}

0 commit comments

Comments
 (0)