Skip to content

Commit

Permalink
Same instructions, but simpler.
Browse files Browse the repository at this point in the history
  • Loading branch information
gilescope committed Jan 26, 2021
1 parent c07e558 commit a623ea5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/core/src/str/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl<'a> Iterator for Chars<'a> {
#[inline]
fn count(self) -> usize {
// 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]
Expand Down

0 comments on commit a623ea5

Please sign in to comment.