Skip to content

Commit a623ea5

Browse files
committed
Same instructions, but simpler.
1 parent c07e558 commit a623ea5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/core/src/str/iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl<'a> Iterator for Chars<'a> {
4747
#[inline]
4848
fn count(self) -> usize {
4949
// length in `char` is equal to the number of non-continuation bytes
50-
self.iter.map(|&byte| !utf8_is_cont_byte(byte) as usize).sum()
50+
self.iter.filter(|&&byte| !utf8_is_cont_byte(byte)).count()
5151
}
5252

5353
#[inline]

0 commit comments

Comments
 (0)