Same instructions, but simpler.

This commit is contained in:
Giles Cope 2021-01-26 21:51:18 +00:00
parent c07e5585b3
commit a623ea5301
No known key found for this signature in database
GPG Key ID: DF85161DAE0FF36B

View File

@ -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]