Skip to content

Commit 17b80a1

Browse files
committed
Revert "Error instead"
This reverts commit 2f1984a.
1 parent 2f1984a commit 17b80a1

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/delay.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
66
use std::fmt;
77
use std::future::Future;
8-
use std::io;
98
use std::pin::Pin;
109
use std::sync::atomic::AtomicUsize;
1110
use std::sync::atomic::Ordering::SeqCst;
@@ -126,19 +125,16 @@ impl Delay {
126125
}
127126

128127
impl Future for Delay {
129-
type Output = io::Result<()>;
128+
type Output = ();
130129

131130
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
132131
let state = match self.state {
133132
Some(ref state) => state,
134-
None => {
135-
let err = Err(io::Error::new(io::ErrorKind::Other, "timer has gone away"));
136-
return Poll::Ready(err);
137-
}
133+
None => panic!("timer has gone away"),
138134
};
139135

140136
if state.state.load(SeqCst) & 1 != 0 {
141-
return Poll::Ready(Ok(()));
137+
return Poll::Ready(());
142138
}
143139

144140
state.waker.register(&cx.waker());
@@ -147,11 +143,8 @@ impl Future for Delay {
147143
// state. If we've fired the first bit is set, and if we've been
148144
// invalidated the second bit is set.
149145
match state.state.load(SeqCst) {
150-
n if n & 0b01 != 0 => Poll::Ready(Ok(())),
151-
n if n & 0b10 != 0 => Poll::Ready(Err(io::Error::new(
152-
io::ErrorKind::Other,
153-
"timer has gone away",
154-
))),
146+
n if n & 0b01 != 0 => Poll::Ready(()),
147+
n if n & 0b10 != 0 => panic!("timer has gone away"),
155148
_ => Poll::Pending,
156149
}
157150
}

0 commit comments

Comments
 (0)