diff options
Diffstat (limited to 'src/stream_ext/timeout.rs')
-rw-r--r-- | src/stream_ext/timeout.rs | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/src/stream_ext/timeout.rs b/src/stream_ext/timeout.rs index 98d7cd5..de17dc0 100644 --- a/src/stream_ext/timeout.rs +++ b/src/stream_ext/timeout.rs @@ -69,18 +69,7 @@ impl<S: Stream> Stream for Timeout<S> { } fn size_hint(&self) -> (usize, Option<usize>) { - let (lower, upper) = self.stream.size_hint(); - - // The timeout stream may insert an error before and after each message - // from the underlying stream, but no more than one error between each - // message. Hence the upper bound is computed as 2x+1. - - // Using a helper function to enable use of question mark operator. - fn twice_plus_one(value: Option<usize>) -> Option<usize> { - value?.checked_mul(2)?.checked_add(1) - } - - (lower, twice_plus_one(upper)) + self.stream.size_hint() } } |