From 5dbea93266c3a30dac5ec6f5a7915d73a440f573 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 25 Apr 2020 13:14:30 +0200 Subject: 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 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). --- src/fexpr/grammar.lalrpop | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/fexpr/grammar.lalrpop') diff --git a/src/fexpr/grammar.lalrpop b/src/fexpr/grammar.lalrpop index caaaf7f..d8f64fa 100644 --- a/src/fexpr/grammar.lalrpop +++ b/src/fexpr/grammar.lalrpop @@ -44,19 +44,19 @@ Negation: T = { } LogPredicate: Box = { - "-success" => filters::log::OutcomeFilter::success(), - "-wipe" => filters::log::OutcomeFilter::wipe(), - "-outcome" > => filters::log::OutcomeFilter::new(<>), + "-success" => filters::log::success(), + "-wipe" => filters::log::wipe(), + "-outcome" > => filters::log::outcome(<>), - "-weekday" > => filters::log::WeekdayFilter::new(<>), - "-before" => filters::log::TimeFilter::new(None, Some(<>)), - "-after" => filters::log::TimeFilter::new(Some(<>), None), + "-weekday" > => filters::log::weekday(<>), + "-before" => filters::log::before(<>), + "-after" => filters::log::after(<>), - "-boss" > => filters::log::BossFilter::new(<>), + "-boss" > => filters::log::boss(<>), "-player" => filters::player::any( - filters::player::NameFilter::new(SearchField::Character, <>.clone()) - | filters::player::NameFilter::new(SearchField::Account, <>) + filters::player::character(<>.clone()) + | filters::player::account(<>) ), "all" "(" "player" ":" ")" => filters::player::all(<>), @@ -67,11 +67,11 @@ LogPredicate: Box = { } PlayerPredicate: Box = { - "-character" => filters::player::NameFilter::new(SearchField::Character, <>), - "-account" => filters::player::NameFilter::new(SearchField::Account, <>), + "-character" => filters::player::character(<>), + "-account" => filters::player::account(<>), "-name" => - filters::player::NameFilter::new(SearchField::Account, <>.clone()) - | filters::player::NameFilter::new(SearchField::Character, <>), + filters::player::account(<>.clone()) + | filters::player::character(<>), "(" ")", } -- cgit v1.2.3