apply clippy suggestions

This commit is contained in:
Tamo 2022-01-10 15:59:04 +01:00
parent 0fcde35a20
commit 92804f6f45
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69
4 changed files with 5 additions and 11 deletions

View File

@ -63,11 +63,5 @@ pub fn parse_to(input: Span) -> IResult<FilterCondition> {
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 } }))
}

View File

@ -19,14 +19,14 @@ impl<E> NomErrorExt<E> for nom::Err<E> {
fn map_err<O: FnOnce(E) -> E>(self, op: O) -> nom::Err<E> {
match self {
e @ Self::Failure(_) => e,
e => e.map(|e| op(e)),
e => e.map(op),
}
}
fn map_fail<O: FnOnce(E) -> E>(self, op: O) -> nom::Err<E> {
match self {
e @ Self::Error(_) => e,
e => e.map(|e| op(e)),
e => e.map(op),
}
}
}

View File

@ -233,7 +233,7 @@ fn parse_geo_point(input: Span) -> IResult<FilterCondition> {
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

View File

@ -10,7 +10,7 @@ fn main() {
}
Err(e) => {
println!("❎ Invalid filter");
println!("{}", e.to_string());
println!("{}", e);
}
}
}