From 92804f6f459bb1b5defa46de8f90923fa3b78d94 Mon Sep 17 00:00:00 2001 From: Tamo Date: Mon, 10 Jan 2022 15:59:04 +0100 Subject: [PATCH] apply clippy suggestions --- filter-parser/src/condition.rs | 8 +------- filter-parser/src/error.rs | 4 ++-- filter-parser/src/lib.rs | 2 +- filter-parser/src/main.rs | 2 +- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/filter-parser/src/condition.rs b/filter-parser/src/condition.rs index abd549534..264787055 100644 --- a/filter-parser/src/condition.rs +++ b/filter-parser/src/condition.rs @@ -63,11 +63,5 @@ pub fn parse_to(input: Span) -> IResult { let (input, (key, from, _, to)) = tuple((parse_value, parse_value, tag("TO"), cut(parse_value)))(input)?; - Ok(( - input, - FilterCondition::Condition { - fid: key.into(), - op: Between { from: from.into(), to: to.into() }, - }, - )) + Ok((input, FilterCondition::Condition { fid: key, op: Between { from, to } })) } diff --git a/filter-parser/src/error.rs b/filter-parser/src/error.rs index dc13861a1..ddf7bea47 100644 --- a/filter-parser/src/error.rs +++ b/filter-parser/src/error.rs @@ -19,14 +19,14 @@ impl NomErrorExt for nom::Err { fn map_err E>(self, op: O) -> nom::Err { match self { e @ Self::Failure(_) => e, - e => e.map(|e| op(e)), + e => e.map(op), } } fn map_fail E>(self, op: O) -> nom::Err { match self { e @ Self::Error(_) => e, - e => e.map(|e| op(e)), + e => e.map(op), } } } diff --git a/filter-parser/src/lib.rs b/filter-parser/src/lib.rs index 07ee57a99..bad7dbc64 100644 --- a/filter-parser/src/lib.rs +++ b/filter-parser/src/lib.rs @@ -233,7 +233,7 @@ fn parse_geo_point(input: Span) -> IResult { multispace0, tag("_geoPoint"), // if we were able to parse `_geoPoint` we are going to return a Failure whatever happens next. - cut(delimited(char('('), separated_list1(tag(","), ws(|c| recognize_float(c))), char(')'))), + cut(delimited(char('('), separated_list1(tag(","), ws(recognize_float)), char(')'))), ))(input) .map_err(|e| e.map(|_| Error::new_from_kind(input, ErrorKind::ReservedGeo("_geoPoint"))))?; // if we succeeded we still return a `Failure` because geoPoints are not allowed diff --git a/filter-parser/src/main.rs b/filter-parser/src/main.rs index a3e4cab28..15ab86188 100644 --- a/filter-parser/src/main.rs +++ b/filter-parser/src/main.rs @@ -10,7 +10,7 @@ fn main() { } Err(e) => { println!("❎ Invalid filter"); - println!("{}", e.to_string()); + println!("{}", e); } } }