From 9401a62004f3ac7313f6bf12d2649d5af61835c5 Mon Sep 17 00:00:00 2001 From: Jokler Date: Fri, 21 Sep 2018 00:59:44 +0200 Subject: Quote: Ignore trailing space when no index was specified --- src/plugins/quote/database.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/plugins/quote/database.rs') diff --git a/src/plugins/quote/database.rs b/src/plugins/quote/database.rs index 6ad08a0..49d6058 100644 --- a/src/plugins/quote/database.rs +++ b/src/plugins/quote/database.rs @@ -46,7 +46,9 @@ pub trait Database: Send + Sync { } // HashMap -impl Database for HashMap<(String, String, i32), Quote, S> { +impl Database + for HashMap<(String, String, i32), Quote, S> +{ fn insert_quote(&mut self, quote: &NewQuote) -> Result<(), QuoteError> { let quote = Quote { quotee: quote.quotee.to_owned(), @@ -66,13 +68,17 @@ impl Database for HashMap<(String, St } fn get_quote(&self, quotee: &str, channel: &str, idx: i32) -> Result { - Ok(self.get(&(quotee.to_owned(), channel.to_owned(), idx)) + Ok(self + .get(&(quotee.to_owned(), channel.to_owned(), idx)) .cloned() .ok_or(ErrorKind::NotFound)?) } fn count_quotes(&self, quotee: &str, channel: &str) -> Result { - Ok(self.iter().filter(|&(&(ref n, ref c, _), _)| n == quotee && c == channel).count() as i32) + Ok(self + .iter() + .filter(|&(&(ref n, ref c, _), _)| n == quotee && c == channel) + .count() as i32) } } -- cgit v1.2.3-70-g09d2