From 73df873f44adeb2d483c975e9ecbb3791e40de3f Mon Sep 17 00:00:00 2001 From: Irevoire Date: Tue, 9 Nov 2021 16:40:05 +0100 Subject: [PATCH] fix typos --- filter-parser/README.md | 3 +-- filter-parser/src/lib.rs | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/filter-parser/README.md b/filter-parser/README.md index 0999b4340..dfbc03d07 100644 --- a/filter-parser/README.md +++ b/filter-parser/README.md @@ -33,5 +33,4 @@ cargo fuzz run parse -- -max_len=500 ## What to do if you find a bug in the parser - Write a test at the end of the [`lib.rs`](./src/lib.rs) to ensure it never happens again. -- Add a file in [the corpus directory](./fuzz/corpus/parse/) with your filter to help the fuzzer finding new bug. Since this directory is going to be heavily polluted by the execution of the fuzzer it's in the gitignore and you'll need to force push your new test. - Since this directory is going to be heavily polluted by the execution of the fuzzer it's in the gitignore and you'll need to force add your new test. +- Add a file in [the corpus directory](./fuzz/corpus/parse/) with your filter to help the fuzzer find new bugs. Since this directory is going to be heavily polluted by the execution of the fuzzer it's in the gitignore and you'll need to force push your new test. diff --git a/filter-parser/src/lib.rs b/filter-parser/src/lib.rs index 073057b76..3e34e4d96 100644 --- a/filter-parser/src/lib.rs +++ b/filter-parser/src/lib.rs @@ -141,7 +141,7 @@ impl<'a> FilterCondition<'a> { } } -/// remove OPTIONAL whitespaces before AND after the the provided parser. +/// remove OPTIONAL whitespaces before AND after the provided parser. fn ws<'a, O>(inner: impl FnMut(Span<'a>) -> IResult) -> impl FnMut(Span<'a>) -> IResult { delimited(multispace0, inner, multispace0) } @@ -184,7 +184,7 @@ fn parse_geo_radius(input: Span) -> IResult { // we want to forbid space BEFORE the _geoRadius but not after let parsed = preceded( 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 return a failure cut(delimited(char('('), separated_list1(tag(","), ws(recognize_float)), char(')'))), )(input) .map_err(|e| e.map(|_| Error::new_from_kind(input, ErrorKind::Geo))); @@ -212,7 +212,7 @@ fn parse_geo_point(input: Span) -> IResult { cut(delimited(char('('), separated_list1(tag(","), ws(|c| recognize_float(c))), char(')'))), ))(input) .map_err(|e| e.map(|_| Error::new_from_kind(input, ErrorKind::ReservedGeo("_geoPoint"))))?; - // if we succeeded we still returns a Failure because geoPoints are not allowed + // if we succeeded we still return a `Failure` because geoPoints are not allowed Err(nom::Err::Failure(Error::new_from_kind(input, ErrorKind::ReservedGeo("_geoPoint")))) }