From 15bd14297efbcf5ae901ab0e73ad6201473485fa Mon Sep 17 00:00:00 2001 From: Tamo Date: Tue, 9 Nov 2021 00:45:46 +0100 Subject: [PATCH] Remove useless closure Co-authored-by: marin --- filter_parser/src/condition.rs | 5 ++--- filter_parser/src/value.rs | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/filter_parser/src/condition.rs b/filter_parser/src/condition.rs index faacceb72..b58a9f9f9 100644 --- a/filter_parser/src/condition.rs +++ b/filter_parser/src/condition.rs @@ -43,9 +43,8 @@ impl<'a> Condition<'a> { /// condition = value ("==" | ">" ...) value pub fn parse_condition(input: Span) -> IResult { let operator = alt((tag("<="), tag(">="), tag("!="), tag("<"), tag(">"), tag("="))); - let (input, (key, op, value)) = tuple((|c| parse_value(c), operator, cut(parse_value)))(input)?; + let (input, (fid, op, value)) = tuple((parse_value, operator, cut(parse_value)))(input)?; - let fid = key; match *op.fragment() { "=" => { @@ -73,7 +72,7 @@ pub fn parse_condition(input: Span) -> IResult { /// to = value value TO value pub fn parse_to(input: Span) -> IResult { let (input, (key, from, _, to)) = - tuple((|c| parse_value(c), |c| parse_value(c), tag("TO"), cut(parse_value)))(input)?; + tuple((parse_value, parse_value, tag("TO"), cut(parse_value)))(input)?; Ok(( input, diff --git a/filter_parser/src/value.rs b/filter_parser/src/value.rs index 4c769fe5f..d82eda008 100644 --- a/filter_parser/src/value.rs +++ b/filter_parser/src/value.rs @@ -28,9 +28,9 @@ pub fn parse_value(input: Span) -> IResult { } // singleQuoted = "'" .* all but quotes "'" - let simple_quoted = |input| take_till(|c: char| c == '\'')(input); + let simple_quoted = take_till(|c: char| c == '\''); // doubleQuoted = "\"" (word | spaces)* "\"" - let double_quoted = |input| take_till(|c: char| c == '"')(input); + let double_quoted = take_till(|c: char| c == '"'); // word = (alphanumeric | _ | - | .)+ let word = take_while1(is_key_component);