diff options
| author | Giles Cope <gilescope@gmail.com> | 2021-01-26 21:51:18 +0000 |
|---|---|---|
| committer | Giles Cope <gilescope@gmail.com> | 2021-01-26 21:57:50 +0000 |
| commit | a623ea5301737507a8229c2ddae74b20f727bd1b (patch) | |
| tree | 778acf8e17c693169c4ce88d4c7cbc8e2bfcd2cd | |
| parent | c07e5585b312aaa76f7bd35e60cf8e8d9164369c (diff) | |
Same instructions, but simpler.
| -rw-r--r-- | library/core/src/str/iter.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/core/src/str/iter.rs b/library/core/src/str/iter.rs index 0c74f6e45a7..83f484dc570 100644 --- a/library/core/src/str/iter.rs +++ b/library/core/src/str/iter.rs @@ -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] |
