Skip to content

Commit

Permalink
Avoid recomputing the index each time.
Browse files Browse the repository at this point in the history
  • Loading branch information
sciguyryan committed Feb 4, 2025
1 parent bf3229e commit 4e0d428
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions redox-core/src/parsing/asm_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ impl<'a> AsmParser<'a> {
let mut end_pos = 0;

let graphemes: Vec<&str> = line.graphemes(true).collect();
let len = graphemes.len();
let max = graphemes.len() - 1;

for (i, g) in graphemes.iter().enumerate() {
// What type of grapheme are we dealing with?
Expand All @@ -1093,7 +1093,7 @@ impl<'a> AsmParser<'a> {
}

// We always want to be sure to catch the last grapheme.
if i == len - 1 {
if i == max {
segment_end = true;
end_pos += 1;
}
Expand Down

0 comments on commit 4e0d428

Please sign in to comment.