Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
expr: Simplify checking of the end of an expression
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
  • Loading branch information
frendsick and cakebaker authored May 24, 2025
commit 2a862bc385a6ac4ec15465776b100c84115d7654
8 changes: 1 addition & 7 deletions src/uu/expr/src/syntax_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,7 @@ where
{
let mut pattern_chars_clone = pattern_chars.clone();
match pattern_chars_clone.next() {
Some('\\') => {
match pattern_chars_clone.next() {
Some(')') // End of a capturing group
| Some('|') => true, // End of an alternative pattern
_ => false,
}
}
Some('\\') => matches!(pattern_chars_clone.next(), Some(')' | '|')),
None => true, // No characters left
_ => false,
}
Expand Down
Loading