Skip to content

Commit bea5cd1

Browse files
committed
Improve size_hint lower bound for DecodeUtf16 iterator
1 parent 47ae8de commit bea5cd1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/core/src/char/decode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl<I: Iterator<Item = u16>> Iterator for DecodeUtf16<I> {
122122
let (low, high) = self.iter.size_hint();
123123
// we could be entirely valid surrogates (2 elements per
124124
// char), or entirely non-surrogates (1 element per char)
125-
(low / 2, high)
125+
(low.div_ceil(2), high)
126126
}
127127
}
128128

0 commit comments

Comments
 (0)