Skip to content

Commit

Permalink
Merge pull request #92 from YohDeadfall/immutable-local
Browse files Browse the repository at this point in the history
Made local variable immutable by moving it into loop
  • Loading branch information
Manishearth committed Mar 22, 2021
2 parents cea3ce6 + 6884202 commit 1d3e87d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/word.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,13 @@ impl<'a> Iterator for UWordBounds<'a> {
let mut cat = wd::WC_Any;
let mut savecat = wd::WC_Any;

// Whether or not the previous category was ZWJ
// ZWJs get collapsed, so this handles precedence of WB3c over WB4
let mut prev_zwj;
// If extend/format/zwj were skipped. Handles precedence of WB3d over WB4
let mut skipped_format_extend = false;
for (curr, ch) in self.string.char_indices() {
idx = curr;
prev_zwj = cat == wd::WC_ZWJ;
// Whether or not the previous category was ZWJ
// ZWJs get collapsed, so this handles precedence of WB3c over WB4
let prev_zwj = cat == wd::WC_ZWJ;
// if there's a category cached, grab it
cat = match self.cat {
None => wd::word_category(ch).2,
Expand Down

0 comments on commit 1d3e87d

Please sign in to comment.