Skip to content

Commit 5821d8a

Browse files
committed
refactor(strings): improve backslash handling in quoted UTF-8 parsing
- Replaced the check for even consecutive backslashes with a call to `is_multiple_of(2)` in the `parse_quoted_utf8` function. - This change enhances code clarity and maintains the same functionality for terminating quoted strings.
1 parent c316577 commit 5821d8a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

langcodec/src/formats/strings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ fn parse_quoted_utf8(source: &str, bytes: &[u8], i: usize) -> Option<(usize, Str
391391
}
392392
if b == b'"' {
393393
// If number of preceding backslashes is even, the quote terminates the string
394-
if consecutive_backslashes % 2 == 0 {
394+
if consecutive_backslashes.is_multiple_of(2) {
395395
let end = j;
396396
let s = &source[start..end];
397397
return Some((j + 1, s.to_string()));

0 commit comments

Comments
 (0)