Remove useless closure

Co-authored-by: marin <postma.marin@protonmail.com>
This commit is contained in:
Tamo 2021-11-09 00:45:46 +01:00 committed by GitHub
parent 21d115dcbb
commit 15bd14297e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -43,9 +43,8 @@ impl<'a> Condition<'a> {
/// condition = value ("==" | ">" ...) value /// condition = value ("==" | ">" ...) value
pub fn parse_condition(input: Span) -> IResult<FilterCondition> { pub fn parse_condition(input: Span) -> IResult<FilterCondition> {
let operator = alt((tag("<="), tag(">="), tag("!="), tag("<"), tag(">"), tag("="))); 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() { match *op.fragment() {
"=" => { "=" => {
@ -73,7 +72,7 @@ pub fn parse_condition(input: Span) -> IResult<FilterCondition> {
/// to = value value TO value /// to = value value TO value
pub fn parse_to(input: Span) -> IResult<FilterCondition> { pub fn parse_to(input: Span) -> IResult<FilterCondition> {
let (input, (key, from, _, to)) = 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(( Ok((
input, input,

View File

@ -28,9 +28,9 @@ pub fn parse_value(input: Span) -> IResult<Token> {
} }
// singleQuoted = "'" .* all but quotes "'" // 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)* "\"" // doubleQuoted = "\"" (word | spaces)* "\""
let double_quoted = |input| take_till(|c: char| c == '"')(input); let double_quoted = take_till(|c: char| c == '"');
// word = (alphanumeric | _ | - | .)+ // word = (alphanumeric | _ | - | .)+
let word = take_while1(is_key_component); let word = take_while1(is_key_component);