From 4e0d428f6f6e77b6e732a314cab42a6a72450819 Mon Sep 17 00:00:00 2001 From: Ryan Jones-Ward Date: Tue, 4 Feb 2025 17:18:05 +0000 Subject: [PATCH] Avoid recomputing the index each time. --- redox-core/src/parsing/asm_parser.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redox-core/src/parsing/asm_parser.rs b/redox-core/src/parsing/asm_parser.rs index a73169b..6318ee5 100644 --- a/redox-core/src/parsing/asm_parser.rs +++ b/redox-core/src/parsing/asm_parser.rs @@ -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? @@ -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; }