From 6515838d35ad510af9ade79245278044db96c331 Mon Sep 17 00:00:00 2001 From: Irevoire Date: Tue, 9 Nov 2021 00:57:46 +0100 Subject: [PATCH] improve the readability of the _geoPoint thingy in the value --- filter_parser/src/value.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/filter_parser/src/value.rs b/filter_parser/src/value.rs index 6f7952ebd..b716dab66 100644 --- a/filter_parser/src/value.rs +++ b/filter_parser/src/value.rs @@ -13,9 +13,12 @@ pub fn parse_value(input: Span) -> IResult { let (input, _) = take_while(char::is_whitespace)(input)?; // then, we want to check if the user is misusing a geo expression - let err = parse_geo_point(input).unwrap_err(); - if err.is_failure() { - return Err(err); + // This expression can’t finish without error. + // We want to return an error in case of failure. + if let Err(err) = parse_geo_point(input) { + if err.is_failure() { + return Err(err); + } } match parse_geo_radius(input) { Ok(_) => return Err(nom::Err::Failure(Error::new_from_kind(input, ErrorKind::MisusedGeo))),