Simplify code.
This commit is contained in:
@@ -2192,11 +2192,10 @@ fn parse_binary_op<'a>(
|
||||
let mut current_lhs = lhs;
|
||||
|
||||
loop {
|
||||
let (current_precedence, bind_right) = if let Some((current_op, _)) = input.peek() {
|
||||
(current_op.precedence(), current_op.is_bind_right())
|
||||
} else {
|
||||
(0, false)
|
||||
};
|
||||
let (current_precedence, bind_right) = input.peek().map_or_else(
|
||||
|| (0, false),
|
||||
|(current_op, _)| (current_op.precedence(), current_op.is_bind_right()),
|
||||
);
|
||||
|
||||
// Bind left to the parent lhs expression if precedence is higher
|
||||
// If same precedence, then check if the operator binds right
|
||||
|
Reference in New Issue
Block a user