summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2022-12-27 18:38:20 +0200
committerManos Pitsidianakis <el13635@mail.ntua.gr>2022-12-27 18:38:20 +0200
commit5443b7e8f300a0084abde7354360ecbe909178bb (patch)
treede7a964b62b8ca9213d4143f825a06f17776c0b7
parent3c847ad26afcc4a4cdcfbdbf70f35be57d0da1ab (diff)
downloadmeli-5443b7e8f300a0084abde7354360ecbe909178bb.zip
melib/sieve: remove literal_map() parse combinator
-rw-r--r--melib/src/sieve.rs13
1 files changed, 4 insertions, 9 deletions
diff --git a/melib/src/sieve.rs b/melib/src/sieve.rs
index 60da6432..d84e07b3 100644
--- a/melib/src/sieve.rs
+++ b/melib/src/sieve.rs
@@ -358,11 +358,6 @@ pub mod parser {
quoted_string()
}
- #[inline(always)]
- pub fn literal_map<'a, T: Clone>(literal: &'static str, value: T) -> impl Parser<'a, T> {
- move |input| map(parse_token(literal), |_| value.clone()).parse(input)
- }
-
// number = 1*DIGIT [ QUANTIFIER ]
// QUANTIFIER = "K" / "M" / "G"
pub fn number<'a>() -> impl Parser<'a, u64> {
@@ -388,8 +383,8 @@ pub mod parser {
move |input| {
ws(pair(
either(
- literal_map(":over", IntegerOperator::Over),
- literal_map(":under", IntegerOperator::Under),
+ map(parse_token(":over"), |_| IntegerOperator::Over),
+ map(parse_token(":under"), |_| IntegerOperator::Under),
),
ws(number()),
))
@@ -521,8 +516,8 @@ pub mod parser {
move |input| {
either(
either(
- literal_map("true", ConditionRule::Literal(true)),
- literal_map("false", ConditionRule::Literal(false)),
+ map(parse_token("true"), |_| ConditionRule::Literal(true)),
+ map(parse_token("false"), |_| ConditionRule::Literal(false)),
),
either(
either(