Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bea5cd1

Browse files
committedSep 8, 2021
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

Lines changed: 1 addition & 1 deletion
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)
Please sign in to comment.