1
Fork 0

Commit code for option size hint

This commit is contained in:
Phlosioneer 2018-03-31 01:13:02 -04:00
parent 01af316867
commit 5057e3c9e1

View file

@ -1191,7 +1191,12 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
self.iter.size_hint()
if self.found_none {
(0, Some(0))
} else {
let (_, upper) = self.iter.size_hint();
(0, upper)
}
}
}