From 23344242346211c8b7c8609845bdd28599b78bcf Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 17 Sep 2023 18:02:19 +0200 Subject: [PATCH] parse_util: fix regressions from port Tested by the upcoming highlighting unit tests. --- fish-rust/src/parse_util.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fish-rust/src/parse_util.rs b/fish-rust/src/parse_util.rs index 1fbd7453c..93acb395b 100644 --- a/fish-rust/src/parse_util.rs +++ b/fish-rust/src/parse_util.rs @@ -52,14 +52,14 @@ pub fn parse_util_slice_length(input: &wstr) -> Option { if !escaped { if ['\'', '"'].contains(&c) { pos = quote_end(input, pos, c)?; - } - } else if c == openc { - bracket_count += 1; - } else if c == closec { - bracket_count -= 1; - if bracket_count == 0 { - // pos points at the closing ], so add 1. - return Some(pos + 1); + } else if c == openc { + bracket_count += 1; + } else if c == closec { + bracket_count -= 1; + if bracket_count == 0 { + // pos points at the closing ], so add 1. + return Some(pos + 1); + } } } if c == '\\' { @@ -1013,8 +1013,8 @@ pub fn parse_util_detect_errors( if !parse_errors.is_empty() { if let Some(errors) = out_errors.as_mut() { errors.extend(parse_errors); - return Err(ParserTestErrorBits::ERROR); } + return Err(ParserTestErrorBits::ERROR); } // Defer to the tree-walking version.