From a91a93f0e2016ae74ecb410d7df98037c53d55bb Mon Sep 17 00:00:00 2001 From: kageru Date: Tue, 18 Apr 2023 00:43:15 +0200 Subject: [PATCH] fix readable output for |-separated filters --- src/main.rs | 2 +- src/parser.rs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 17a5b7b..4a19b7b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -167,7 +167,7 @@ fn add_searchbox(res: &mut String, query: &Option) -> std::fmt::Result { fn compute_results(raw_query: String) -> AnyResult { let mut body = String::with_capacity(10_000); - let (raw_filters, query) = match parser::parse_filters(&raw_query.trim()) { + let (raw_filters, query) = match parser::parse_filters(raw_query.trim()) { Ok(q) => q, Err(e) => { let s = format!("Could not parse query: {e:?}"); diff --git a/src/parser.rs b/src/parser.rs index 0cc441a..6a6a0ef 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -251,10 +251,7 @@ impl Display for Value { } Self::Numerical(n) => write!(f, "{n}"), Self::Multiple(m) => { - for v in m { - write!(f, "{v} or ")? - } - Ok(()) + write!(f, "one of [{}]", m.iter().map(Value::to_string).join(", ")) } } }