about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGiles Cope <gilescope@gmail.com>2021-01-26 11:26:58 +0000
committerGiles Cope <gilescope@gmail.com>2021-01-26 11:26:58 +0000
commit425a70a460abac1182a792c6c2af6dff69663c3c (patch)
treed6dd12b002dc99773e0cd68f81d4e42c8433a106
parent328abfb9431c486ab2d0b9ebd7f6115805f613de (diff)
downloadrust-425a70a460abac1182a792c6c2af6dff69663c3c.tar.gz
rust-425a70a460abac1182a792c6c2af6dff69663c3c.zip
Removing if so it's more like the previous implementation.
-rw-r--r--library/core/src/str/iter.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/library/core/src/str/iter.rs b/library/core/src/str/iter.rs
index c3784343478..34c31d599a3 100644
--- a/library/core/src/str/iter.rs
+++ b/library/core/src/str/iter.rs
@@ -49,9 +49,7 @@ impl<'a> Iterator for Chars<'a> {
         // length in `char` is equal to the number of non-continuation bytes
         let mut char_count = 0;
         for &byte in self.iter {
-            if !utf8_is_cont_byte(byte) {
-                char_count += 1;
-            }
+            char_count += !utf8_is_cont_byte(byte) as usize;
         }
         char_count
     }