Same instructions, but simpler.
This commit is contained in:
parent
c07e5585b3
commit
a623ea5301
@ -47,7 +47,7 @@ fn next(&mut self) -> Option<char> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
fn count(self) -> usize {
|
fn count(self) -> usize {
|
||||||
// length in `char` is equal to the number of non-continuation bytes
|
// length in `char` is equal to the number of non-continuation bytes
|
||||||
self.iter.map(|&byte| !utf8_is_cont_byte(byte) as usize).sum()
|
self.iter.filter(|&&byte| !utf8_is_cont_byte(byte)).count()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
Loading…
Reference in New Issue
Block a user