mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 03:55:07 +08:00
apply clippy suggestions
This commit is contained in:
parent
0fcde35a20
commit
92804f6f45
@ -63,11 +63,5 @@ pub fn parse_to(input: Span) -> IResult<FilterCondition> {
|
|||||||
let (input, (key, from, _, to)) =
|
let (input, (key, from, _, to)) =
|
||||||
tuple((parse_value, parse_value, tag("TO"), cut(parse_value)))(input)?;
|
tuple((parse_value, parse_value, tag("TO"), cut(parse_value)))(input)?;
|
||||||
|
|
||||||
Ok((
|
Ok((input, FilterCondition::Condition { fid: key, op: Between { from, to } }))
|
||||||
input,
|
|
||||||
FilterCondition::Condition {
|
|
||||||
fid: key.into(),
|
|
||||||
op: Between { from: from.into(), to: to.into() },
|
|
||||||
},
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
@ -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> {
|
fn map_err<O: FnOnce(E) -> E>(self, op: O) -> nom::Err<E> {
|
||||||
match self {
|
match self {
|
||||||
e @ Self::Failure(_) => e,
|
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> {
|
fn map_fail<O: FnOnce(E) -> E>(self, op: O) -> nom::Err<E> {
|
||||||
match self {
|
match self {
|
||||||
e @ Self::Error(_) => e,
|
e @ Self::Error(_) => e,
|
||||||
e => e.map(|e| op(e)),
|
e => e.map(op),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ fn parse_geo_point(input: Span) -> IResult<FilterCondition> {
|
|||||||
multispace0,
|
multispace0,
|
||||||
tag("_geoPoint"),
|
tag("_geoPoint"),
|
||||||
// if we were able to parse `_geoPoint` we are going to return a Failure whatever happens next.
|
// 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)
|
))(input)
|
||||||
.map_err(|e| e.map(|_| Error::new_from_kind(input, ErrorKind::ReservedGeo("_geoPoint"))))?;
|
.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
|
// if we succeeded we still return a `Failure` because geoPoints are not allowed
|
||||||
|
@ -10,7 +10,7 @@ fn main() {
|
|||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("❎ Invalid filter");
|
println!("❎ Invalid filter");
|
||||||
println!("{}", e.to_string());
|
println!("{}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user