Skip to content

Commit dc00793

Browse files
taiki-ecramertj
authored andcommitted
Make ready and lazy's panic messages easy to understand
1 parent 127b244 commit dc00793

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

futures-util/src/future/lazy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ impl<F, R> Future for Lazy<F>
4949
type Output = R;
5050

5151
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<R> {
52-
Poll::Ready((self.f.take().unwrap())(cx))
52+
Poll::Ready((self.f.take().expect("Lazy polled after completion"))(cx))
5353
}
5454
}

futures-util/src/future/ready.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl<T> Future for Ready<T> {
2828

2929
#[inline]
3030
fn poll(mut self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<T> {
31-
Poll::Ready(self.0.take().unwrap())
31+
Poll::Ready(self.0.take().expect("Ready polled after completion"))
3232
}
3333
}
3434

0 commit comments

Comments
 (0)