aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorDaniel <kingdread@gmx.de>2020-04-25 13:14:30 +0200
committerDaniel <kingdread@gmx.de>2020-04-25 13:19:42 +0200
commit5dbea93266c3a30dac5ec6f5a7915d73a440f573 (patch)
tree9b7bba1b25b2ccebd0b5ed705bf8b7238ddb0893 /src/main.rs
parent509e5817e6e035e762840c00fb95b18253b1d269 (diff)
downloadraidgrep-5dbea93266c3a30dac5ec6f5a7915d73a440f573.tar.gz
raidgrep-5dbea93266c3a30dac5ec6f5a7915d73a440f573.tar.bz2
raidgrep-5dbea93266c3a30dac5ec6f5a7915d73a440f573.zip
use free functions instead of Filter::new
Having a ::new on each of the filter types was a bit weird, especially because we returned Box<dyn ...> instead of Self (and clippy rightfully complained). With this patch, we now have a bunch of normal functions, and we don't show to the outside how a filter is actually implemented (or what struct is behind it).
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 3164bd4..50dcf8d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -266,8 +266,7 @@ fn single(opt: &Opt) -> Result<()> {
let maybe_regex = Regex::new(line);
if let Ok(rgx) = maybe_regex {
let filter = filters::player::any(
- filters::player::NameFilter::new(SearchField::Account, rgx.clone())
- | filters::player::NameFilter::new(SearchField::Character, rgx),
+ filters::player::account(rgx.clone()) | filters::player::character(rgx),
);
return grep(opt, &*filter);
}