Skip to content

Commit

Permalink
Improve size_hint lower bound for DecodeUtf16 iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
steffahn committed Sep 8, 2021
1 parent 47ae8de commit bea5cd1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/core/src/char/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl<I: Iterator<Item = u16>> Iterator for DecodeUtf16<I> {
let (low, high) = self.iter.size_hint();
// we could be entirely valid surrogates (2 elements per
// char), or entirely non-surrogates (1 element per char)
(low / 2, high)
(low.div_ceil(2), high)
}
}

Expand Down

0 comments on commit bea5cd1

Please sign in to comment.