From a1d137116bc616f9bbf78aba3546da489091c9e6 Mon Sep 17 00:00:00 2001 From: Pazzaz Date: Thu, 24 May 2018 19:50:34 +0200 Subject: [PATCH] Avoid unnecessary comparisons with cur_end --- src/string.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/string.rs b/src/string.rs index 8a6b0e685c49..f683eab7dc76 100644 --- a/src/string.rs +++ b/src/string.rs @@ -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; }