Skip to content

Commit 5057e3c

Browse files
committed
Commit code for option size hint
1 parent 01af316 commit 5057e3c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/libcore/option.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,12 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
11911191

11921192
#[inline]
11931193
fn size_hint(&self) -> (usize, Option<usize>) {
1194-
self.iter.size_hint()
1194+
if self.found_none {
1195+
(0, Some(0))
1196+
} else {
1197+
let (_, upper) = self.iter.size_hint();
1198+
(0, upper)
1199+
}
11951200
}
11961201
}
11971202

0 commit comments

Comments
 (0)