This commit is contained in:
kageru 2023-01-26 23:10:13 +01:00
parent f3eeb570ce
commit 4995967cf4
Signed by: kageru
GPG Key ID: 8282A2BEA4ADA3D2
2 changed files with 2 additions and 2 deletions

@ -42,7 +42,7 @@ pub type CardFilter = Box<dyn Fn(&SearchCard) -> bool>;
pub type RawCardFilter = (Field, Operator, Value);
pub fn fallback_filter(query: &str) -> Result<RawCardFilter, String> {
if query.contains(&OPERATOR_CHARS[..]) {
if query.contains(OPERATOR_CHARS) {
return Err(format!("Invalid query: {query}"));
}
#[cfg(debug_assertions)]

@ -30,7 +30,7 @@ fn word_non_empty(input: &str) -> IResult<&str, &str> {
}
fn parse_raw_filter(input: &str) -> IResult<&str, RawCardFilter> {
preceded(multispace0, alt((complete(tuple((field, operator, value))), map_res(word_non_empty, |q| fallback_filter(q)))))(input)
preceded(multispace0, alt((complete(tuple((field, operator, value))), map_res(word_non_empty, fallback_filter))))(input)
}
fn field(input: &str) -> IResult<&str, Field> {