File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -1440,8 +1440,10 @@ impl<'a> Iterator for EncodeUtf16<'a> {
14401440 #[ inline]
14411441 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
14421442 let len = self . chars . iter . len ( ) ;
1443- // The highest bytes:code units ratio occurs for 3-byte sequences, so
1444- // use this to determine the lower bound for the hint. The lowest
1443+ // The highest bytes:code units ratio occurs for 3-byte sequences,
1444+ // since a 4-byte sequence results in 2 code units. The lower bound
1445+ // is therefore determined by assuming the remaining bytes contain as
1446+ // many 3-byte sequences as possible. The highest bytes:code units
14451447 // ratio is for 1-byte sequences, so use this for the upper bound.
14461448 // `(len + 2)` can't overflow, because we know that the `slice::Iter`
14471449 // belongs to a slice in memory which has a maximum length of
You can’t perform that action at this time.
0 commit comments