Skip to content

Commit ef744c5

Browse files
committed
expr: Refactor checking if '$' is the last character
1 parent feb47ae commit ef744c5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/uu/expr/src/syntax_tree.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ impl StringOp {
193193
_ => re_string.push_str(r"\$"),
194194
}
195195
re_string.push(backslash);
196-
} else if pattern_chars.peek().is_none() {
197-
re_string.push('$');
198-
} else if prev_is_escaped || prev != '\\' {
196+
} else if (prev_is_escaped || prev != '\\')
197+
&& pattern_chars.peek().is_some()
198+
{
199199
re_string.push_str(r"\$");
200200
} else {
201201
re_string.push('$');

0 commit comments

Comments
 (0)