]> git.lizzy.rs Git - rust.git/commitdiff
Avoid unnecessary comparisons with cur_end
authorPazzaz <pazzaz.sundqvist@gmail.com>
Thu, 24 May 2018 17:50:34 +0000 (19:50 +0200)
committerPazzaz <pazzaz.sundqvist@gmail.com>
Thu, 24 May 2018 19:32:01 +0000 (21:32 +0200)
src/string.rs

index 8a6b0e685c4939889e8487ece16c431916910881..f683eab7dc76355f8fa8168b5f711f47332802e0 100644 (file)
@@ -105,12 +105,12 @@ pub fn rewrite_string<'a>(
                         while !(punctuation.contains(graphemes[cur_end - 1])
                             || graphemes[cur_end - 1].trim().is_empty())
                         {
-                            if cur_end >= graphemes.len() {
+                            cur_end += 1;
+                            if cur_end == graphemes.len() {
                                 let line = &graphemes[cur_start..].join("");
                                 result.push_str(line);
                                 break 'outer;
                             }
-                            cur_end += 1;
                         }
                         break;
                     }