From 5d1d59954d2eb8227f93bc8188c59e62daadda28 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Thu, 14 Jul 2022 02:10:16 +0530 Subject: [PATCH] chore(config): fix clippy lints --- src/config.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/config.rs b/src/config.rs index ffbe98b..49f52d6 100644 --- a/src/config.rs +++ b/src/config.rs @@ -69,25 +69,21 @@ pub trait Act { impl Replacements<'_> { pub fn validate(&self) -> Result<()> { - for subst in self.substitutors.iter() { + for subst in &self.substitutors { match &subst.matcher { - MatcherType::Single(matcher) => match matcher { - Matcher::Regex { pattern } => { + MatcherType::Single(matcher) => { + if let Matcher::Regex { pattern } = matcher { if let Err(e) = Regex::from_str(pattern) { bail!(e); } } - _ => {} - }, + } MatcherType::Multiple(matchers) => { for matcher in matchers.iter() { - match matcher { - Matcher::Regex { pattern } => { - if let Err(e) = Regex::from_str(pattern) { - bail!(e); - } + if let Matcher::Regex { pattern } = matcher { + if let Err(e) = Regex::from_str(pattern) { + bail!(e); } - _ => {} } } }