mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-27 07:14:26 +01:00
Simplify some closure
Co-authored-by: marin <postma.marin@protonmail.com>
This commit is contained in:
parent
bc9daf9041
commit
cf98bf37d0
@ -179,7 +179,7 @@ fn parse_geo_radius(input: Span) -> IResult<FilterCondition> {
|
|||||||
let parsed = preceded(
|
let parsed = preceded(
|
||||||
tuple((multispace0, tag("_geoRadius"))),
|
tuple((multispace0, tag("_geoRadius"))),
|
||||||
// if we were able to parse `_geoRadius` and can't parse the rest of the input we returns a failure
|
// if we were able to parse `_geoRadius` and can't parse the rest of the input we returns a failure
|
||||||
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::Geo)));
|
.map_err(|e| e.map(|_| Error::new_from_kind(input, ErrorKind::Geo)));
|
||||||
|
|
||||||
@ -221,11 +221,11 @@ fn parse_primary(input: Span) -> IResult<FilterCondition> {
|
|||||||
Error::new_from_kind(input, ErrorKind::MissingClosingDelimiter(c.char()))
|
Error::new_from_kind(input, ErrorKind::MissingClosingDelimiter(c.char()))
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|c| parse_geo_radius(c),
|
parse_geo_radius,
|
||||||
|c| parse_condition(c),
|
parse_condition,
|
||||||
|c| parse_to(c),
|
parse_to,
|
||||||
// the next lines are only for error handling and are written at the end to have the less possible performance impact
|
// the next lines are only for error handling and are written at the end to have the less possible performance impact
|
||||||
|c| parse_geo_point(c),
|
parse_geo_point,
|
||||||
))(input)
|
))(input)
|
||||||
// if the inner parsers did not match enough information to return an accurate error
|
// if the inner parsers did not match enough information to return an accurate error
|
||||||
.map_err(|e| e.map_err(|_| Error::new_from_kind(input, ErrorKind::InvalidPrimary)))
|
.map_err(|e| e.map_err(|_| Error::new_from_kind(input, ErrorKind::InvalidPrimary)))
|
||||||
|
Loading…
Reference in New Issue
Block a user