From 563d02461d84e6405d1cbff4d572c23ab8aa0141 Mon Sep 17 00:00:00 2001 From: MichiRecRoom <1008889+LikeLakers2@users.noreply.github.com> Date: Sat, 21 Sep 2024 14:17:00 -0400 Subject: [PATCH] `total_len` already appears to be in bytes ...so there's no need to get that slice of `remainder`, convert it to `&[u8]`, and get the length of that. --- crates/taplo/src/syntax.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/taplo/src/syntax.rs b/crates/taplo/src/syntax.rs index 036ecf2a9..bae4279d2 100644 --- a/crates/taplo/src/syntax.rs +++ b/crates/taplo/src/syntax.rs @@ -141,7 +141,7 @@ fn lex_string(lex: &mut Lexer) -> bool { } if c == '"' && !escaped { - lex.bump(remainder[0..total_len].as_bytes().len()); + lex.bump(total_len); return true; } @@ -171,7 +171,7 @@ fn lex_multi_line_string(lex: &mut Lexer) -> bool { return false; } - lex.bump(remainder[0..total_len].as_bytes().len()); + lex.bump(total_len); return true; } else { quote_count += 1; @@ -205,7 +205,7 @@ fn lex_multi_line_string(lex: &mut Lexer) -> bool { return false; } - lex.bump(remainder[0..total_len].as_bytes().len()); + lex.bump(total_len); true } else { false @@ -220,7 +220,7 @@ fn lex_string_literal(lex: &mut Lexer) -> bool { total_len += c.len_utf8(); if c == '\'' { - lex.bump(remainder[0..total_len].as_bytes().len()); + lex.bump(total_len); return true; } } @@ -242,7 +242,7 @@ fn lex_multi_line_string_literal(lex: &mut Lexer) -> bool { for c in remainder.chars() { if quotes_found { if c != '\'' { - lex.bump(remainder[0..total_len].as_bytes().len()); + lex.bump(total_len); return true; } else { if quote_count > 4 { @@ -269,7 +269,7 @@ fn lex_multi_line_string_literal(lex: &mut Lexer) -> bool { // End of input if quotes_found { - lex.bump(remainder[0..total_len].as_bytes().len()); + lex.bump(total_len); true } else { false