improve the readability of the _geoPoint thingy in the value

This commit is contained in:
Irevoire 2021-11-09 00:57:46 +01:00
parent ea52aff6dc
commit 6515838d35
No known key found for this signature in database
GPG Key ID: 7A6A970C96104F1B

View File

@ -13,9 +13,12 @@ pub fn parse_value(input: Span) -> IResult<Token> {
let (input, _) = take_while(char::is_whitespace)(input)?; let (input, _) = take_while(char::is_whitespace)(input)?;
// then, we want to check if the user is misusing a geo expression // then, we want to check if the user is misusing a geo expression
let err = parse_geo_point(input).unwrap_err(); // This expression cant finish without error.
if err.is_failure() { // We want to return an error in case of failure.
return Err(err); if let Err(err) = parse_geo_point(input) {
if err.is_failure() {
return Err(err);
}
} }
match parse_geo_radius(input) { match parse_geo_radius(input) {
Ok(_) => return Err(nom::Err::Failure(Error::new_from_kind(input, ErrorKind::MisusedGeo))), Ok(_) => return Err(nom::Err::Failure(Error::new_from_kind(input, ErrorKind::MisusedGeo))),