From 8726cb12cf79bd401a061f2775df718368f6cdd1 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Tue, 27 Aug 2019 10:22:26 +0200 Subject: [PATCH] [No-auto] lib/domain/mail: Fix Clippy warnings Signed-off-by: flip1995 Signed-off-by: Matthias Beyer --- lib/domain/libimagmail/src/config.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/domain/libimagmail/src/config.rs b/lib/domain/libimagmail/src/config.rs index 6258e6e3..a58784ae 100644 --- a/lib/domain/libimagmail/src/config.rs +++ b/lib/domain/libimagmail/src/config.rs @@ -51,8 +51,7 @@ impl MailConfig { pub fn account(&self, name: &str) -> Option<&MailAccountConfig> { self.accounts() .iter() - .filter(|a| a.name == name) - .next() + .find(|a| a.name == name) } pub fn fetchcommand(&self) -> &MailCommand { @@ -74,8 +73,7 @@ impl MailConfig { pub fn fetchcommand_for_account(&self, account_name: &str) -> &MailCommand { self.accounts() .iter() - .filter(|a| a.name == account_name) - .next() + .find(|a| a.name == account_name) .and_then(|a| a.fetchcommand.as_ref()) .unwrap_or_else(|| self.fetchcommand()) } @@ -83,8 +81,7 @@ impl MailConfig { pub fn postfetchcommand_for_account(&self, account_name: &str) -> Option<&MailCommand> { self.accounts() .iter() - .filter(|a| a.name == account_name) - .next() + .find(|a| a.name == account_name) .and_then(|a| a.postfetchcommand.as_ref()) .or_else(|| self.postfetchcommand()) } @@ -92,8 +89,7 @@ impl MailConfig { pub fn sendcommand_for_account(&self, account_name: &str) -> &MailCommand { self.accounts() .iter() - .filter(|a| a.name == account_name) - .next() + .find(|a| a.name == account_name) .and_then(|a| a.sendcommand.as_ref()) .unwrap_or_else(|| self.sendcommand()) } @@ -101,8 +97,7 @@ impl MailConfig { pub fn postsendcommand_for_account(&self, account_name: &str) -> Option<&MailCommand> { self.accounts() .iter() - .filter(|a| a.name == account_name) - .next() + .find(|a| a.name == account_name) .and_then(|a| a.postsendcommand.as_ref()) .or_else(|| self.postsendcommand()) }