From 5443b7e8f300a0084abde7354360ecbe909178bb Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Tue, 27 Dec 2022 18:38:20 +0200 Subject: melib/sieve: remove literal_map() parse combinator --- melib/src/sieve.rs | 13 ++++--------- 1 file 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( -- cgit v1.2.3