Skip to content

Commit 4e681b5

Browse files
committed
Merge match arms in parse_formatted_value
1 parent c85f899 commit 4e681b5

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

compiler/parser/src/string_parser.rs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -189,26 +189,11 @@ impl<'a> StringParser<'a> {
189189
match ch {
190190
// can be integrated better with the remaining code, but as a starting point ok
191191
// in general I would do here a tokenizing of the fstrings to omit this peeking.
192-
'!' if self.peek() == Some(&'=') => {
193-
expression.push_str("!=");
194-
self.next_char();
195-
}
196-
197-
'=' if self.peek() == Some(&'=') => {
198-
expression.push_str("==");
199-
self.next_char();
200-
}
201-
202-
'>' if self.peek() == Some(&'=') => {
203-
expression.push_str(">=");
204-
self.next_char();
205-
}
206-
207-
'<' if self.peek() == Some(&'=') => {
208-
expression.push_str("<=");
192+
'!' | '=' | '>' | '<' if self.peek() == Some(&'=') => {
193+
expression.push(ch);
194+
expression.push('=');
209195
self.next_char();
210196
}
211-
212197
'!' if delims.is_empty() && self.peek() != Some(&'=') => {
213198
if expression.trim().is_empty() {
214199
return Err(EmptyExpression.to_lexical_error(self.get_pos()));

0 commit comments

Comments
 (0)