From 331d6b1762d1d9431b210fc98a495d56ad7a1cd1 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 13 May 2020 12:52:13 +0200 Subject: clean up SearchField related code With the addition of our own parser, we no longer need the FromStr implementation for SearchField. Furthermore, it is now only used in player::NameFilter, so the definition has been moved there. The import in the grammar was unused as well, so it has been removed. --- src/main.rs | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 40f434c..ee1c232 100644 --- a/src/main.rs +++ b/src/main.rs @@ -101,30 +101,6 @@ pub struct Opt { expression: Vec, } -/// A flag indicating which fields should be searched. -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum SearchField { - /// Only search the account name. - Account, - /// Only search the character name. - Character, - /// Only search the guild name or tag. - Guild, -} - -impl FromStr for SearchField { - type Err = &'static str; - - fn from_str(s: &str) -> Result { - match s { - "account" => Ok(SearchField::Account), - "character" => Ok(SearchField::Character), - "guild" => Ok(SearchField::Guild), - _ => Err("Must be account or character"), - } - } -} - /// A log that matches the search criteria. #[derive(Debug, Clone)] pub struct LogResult { -- cgit v1.2.3