summaryrefslogtreecommitdiffstats
path: root/vendor/pest/tests/calculator.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:37 +0000
commit246f239d9f40f633160f0c18f87a20922d4e77bb (patch)
tree5a88572663584b3d4d28e5a20e10abab1be40884 /vendor/pest/tests/calculator.rs
parentReleasing progress-linux version 1.64.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-246f239d9f40f633160f0c18f87a20922d4e77bb.tar.xz
rustc-246f239d9f40f633160f0c18f87a20922d4e77bb.zip
Merging debian version 1.65.0+dfsg1-2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--vendor/pest/tests/calculator.rs18
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,