[No-auto] lib/domain/mail: Fix Clippy warnings

Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
flip1995 2019-08-27 10:22:26 +02:00 committed by Matthias Beyer
parent 6307b80027
commit 8726cb12cf

View file

@ -51,8 +51,7 @@ impl MailConfig {
pub fn account(&self, name: &str) -> Option<&MailAccountConfig> { pub fn account(&self, name: &str) -> Option<&MailAccountConfig> {
self.accounts() self.accounts()
.iter() .iter()
.filter(|a| a.name == name) .find(|a| a.name == name)
.next()
} }
pub fn fetchcommand(&self) -> &MailCommand { pub fn fetchcommand(&self) -> &MailCommand {
@ -74,8 +73,7 @@ impl MailConfig {
pub fn fetchcommand_for_account(&self, account_name: &str) -> &MailCommand { pub fn fetchcommand_for_account(&self, account_name: &str) -> &MailCommand {
self.accounts() self.accounts()
.iter() .iter()
.filter(|a| a.name == account_name) .find(|a| a.name == account_name)
.next()
.and_then(|a| a.fetchcommand.as_ref()) .and_then(|a| a.fetchcommand.as_ref())
.unwrap_or_else(|| self.fetchcommand()) .unwrap_or_else(|| self.fetchcommand())
} }
@ -83,8 +81,7 @@ impl MailConfig {
pub fn postfetchcommand_for_account(&self, account_name: &str) -> Option<&MailCommand> { pub fn postfetchcommand_for_account(&self, account_name: &str) -> Option<&MailCommand> {
self.accounts() self.accounts()
.iter() .iter()
.filter(|a| a.name == account_name) .find(|a| a.name == account_name)
.next()
.and_then(|a| a.postfetchcommand.as_ref()) .and_then(|a| a.postfetchcommand.as_ref())
.or_else(|| self.postfetchcommand()) .or_else(|| self.postfetchcommand())
} }
@ -92,8 +89,7 @@ impl MailConfig {
pub fn sendcommand_for_account(&self, account_name: &str) -> &MailCommand { pub fn sendcommand_for_account(&self, account_name: &str) -> &MailCommand {
self.accounts() self.accounts()
.iter() .iter()
.filter(|a| a.name == account_name) .find(|a| a.name == account_name)
.next()
.and_then(|a| a.sendcommand.as_ref()) .and_then(|a| a.sendcommand.as_ref())
.unwrap_or_else(|| self.sendcommand()) .unwrap_or_else(|| self.sendcommand())
} }
@ -101,8 +97,7 @@ impl MailConfig {
pub fn postsendcommand_for_account(&self, account_name: &str) -> Option<&MailCommand> { pub fn postsendcommand_for_account(&self, account_name: &str) -> Option<&MailCommand> {
self.accounts() self.accounts()
.iter() .iter()
.filter(|a| a.name == account_name) .find(|a| a.name == account_name)
.next()
.and_then(|a| a.postsendcommand.as_ref()) .and_then(|a| a.postsendcommand.as_ref())
.or_else(|| self.postsendcommand()) .or_else(|| self.postsendcommand())
} }