diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:03:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:03:36 +0000 |
commit | 17d40c6057c88f4c432b0d7bac88e1b84cb7e67f (patch) | |
tree | 3f66c4a5918660bb8a758ab6cda5ff8ee4f6cdcd /vendor/pest/tests/calculator.rs | |
parent | Adding upstream version 1.64.0+dfsg1. (diff) | |
download | rustc-17d40c6057c88f4c432b0d7bac88e1b84cb7e67f.tar.xz rustc-17d40c6057c88f4c432b0d7bac88e1b84cb7e67f.zip |
Adding upstream version 1.65.0+dfsg1.upstream/1.65.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | vendor/pest/tests/calculator.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/vendor/pest/tests/calculator.rs b/vendor/pest/tests/calculator.rs index b78ee0d27..54a50cc67 100644 --- a/vendor/pest/tests/calculator.rs +++ b/vendor/pest/tests/calculator.rs @@ -40,12 +40,12 @@ impl Parser<Rule> for CalculatorParser { s.repeat(|s| { s.sequence(|s| { plus(s) - .or_else(|s| minus(s)) - .or_else(|s| times(s)) - .or_else(|s| divide(s)) - .or_else(|s| modulus(s)) - .or_else(|s| power(s)) - .and_then(|s| primary(s)) + .or_else(minus) + .or_else(times) + .or_else(divide) + .or_else(modulus) + .or_else(power) + .and_then(primary) }) }) }) @@ -57,10 +57,10 @@ impl Parser<Rule> for CalculatorParser { state .sequence(|s| { s.match_string("(") - .and_then(|s| expression(s)) + .and_then(expression) .and_then(|s| s.match_string(")")) }) - .or_else(|s| number(s)) + .or_else(number) } fn number(state: Box<ParserState<Rule>>) -> ParseResult<Box<ParserState<Rule>>> { @@ -109,7 +109,7 @@ impl Parser<Rule> for CalculatorParser { } } -fn consume<'i>(pair: Pair<'i, Rule>, climber: &PrecClimber<Rule>) -> i32 { +fn consume(pair: Pair<Rule>, climber: &PrecClimber<Rule>) -> i32 { let primary = |pair| consume(pair, climber); let infix = |lhs: i32, op: Pair<Rule>, rhs: i32| match op.as_rule() { Rule::plus => lhs + rhs, |