Skip to content

Commit 2a862bc

Browse files
frendsickcakebaker
andauthored
expr: Simplify checking of the end of an expression
Co-authored-by: Daniel Hofstetter <[email protected]>
1 parent 63ce37c commit 2a862bc

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/uu/expr/src/syntax_tree.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,7 @@ where
244244
{
245245
let mut pattern_chars_clone = pattern_chars.clone();
246246
match pattern_chars_clone.next() {
247-
Some('\\') => {
248-
match pattern_chars_clone.next() {
249-
Some(')') // End of a capturing group
250-
| Some('|') => true, // End of an alternative pattern
251-
_ => false,
252-
}
253-
}
247+
Some('\\') => matches!(pattern_chars_clone.next(), Some(')' | '|')),
254248
None => true, // No characters left
255249
_ => false,
256250
}

0 commit comments

Comments
 (0)