From c5939a5ce8e5e69afec69a04b33c5a802cb8ce20 Mon Sep 17 00:00:00 2001 From: Stadnik Andrii Date: Thu, 29 Jun 2023 20:05:41 +0300 Subject: [PATCH] fix: fix condition for removing element from queue --- core/tests/test_data.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/tests/test_data.rs b/core/tests/test_data.rs index 63e889d5..851552cf 100644 --- a/core/tests/test_data.rs +++ b/core/tests/test_data.rs @@ -8,8 +8,10 @@ fn test_md(s: &str) -> Result<()> { let re = Regex::new(r"(```|\|\||__|`|\*|_|~)").unwrap(); let mut q: VecDeque<&str> = VecDeque::new(); for mat in re.find_iter(s) { - let prev_i = mat.start() - 1; - if mat.start() == 0 || !s.is_char_boundary(prev_i) || &s[prev_i..mat.start()] != "\\" { + if mat.start() == 0 + || !s.is_char_boundary(mat.start() - 1) + || &s[(mat.start() - 1)..mat.start()] != "\\" + { if q.back() == Some(&mat.as_str()) { q.pop_back(); } else {