mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-17 05:25:37 +03:00
Fix incorrect lower bounds
This commit is contained in:
+6
-1
@@ -905,7 +905,12 @@ macro_rules! continuation_byte {
|
||||
|
||||
#[inline]
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
self.0.size_hint()
|
||||
let len = self.iter.len();
|
||||
|
||||
// A code point is at most 4 bytes long.
|
||||
let min_code_points = len / 4;
|
||||
|
||||
(min_code_points, Some(len))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -903,7 +903,12 @@ fn next(&mut self) -> Option<Self::Item> {
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
self.iter.size_hint()
|
||||
if self.error.is_some() {
|
||||
(0, Some(0))
|
||||
} else {
|
||||
let (_, upper) = self.iter.size_hint();
|
||||
(0, upper)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user