diff --git a/espanso-config/src/config/resolve.rs b/espanso-config/src/config/resolve.rs index 8738085..e771beb 100644 --- a/espanso-config/src/config/resolve.rs +++ b/espanso-config/src/config/resolve.rs @@ -37,7 +37,7 @@ use thiserror::Error; const STANDARD_INCLUDES: &[&str] = &["../match/**/[!_]*.yml"]; -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Default)] pub(crate) struct ResolvedConfig { parsed: ParsedConfig, @@ -52,20 +52,6 @@ pub(crate) struct ResolvedConfig { filter_exec: Option, } -impl Default for ResolvedConfig { - fn default() -> Self { - Self { - parsed: Default::default(), - source_path: None, - id: 0, - match_paths: Vec::new(), - filter_title: None, - filter_class: None, - filter_exec: None, - } - } -} - impl Config for ResolvedConfig { fn id(&self) -> i32 { self.id diff --git a/espanso-config/src/legacy/config.rs b/espanso-config/src/legacy/config.rs index 87ff50c..a873744 100644 --- a/espanso-config/src/legacy/config.rs +++ b/espanso-config/src/legacy/config.rs @@ -701,18 +701,15 @@ impl LegacyConfigSet { let mut sorted_triggers: Vec = default .matches .iter() - .flat_map(|t| triggers_for_match(t)) + .flat_map(triggers_for_match) .collect(); sorted_triggers.sort(); let mut has_conflicts = Self::list_has_conflicts(&sorted_triggers); for s in specific.iter() { - let mut specific_triggers: Vec = s - .matches - .iter() - .flat_map(|t| triggers_for_match(t)) - .collect(); + let mut specific_triggers: Vec = + s.matches.iter().flat_map(triggers_for_match).collect(); specific_triggers.sort(); has_conflicts |= Self::list_has_conflicts(&specific_triggers); } diff --git a/espanso-config/src/matches/group/mod.rs b/espanso-config/src/matches/group/mod.rs index 3d61c23..895a183 100644 --- a/espanso-config/src/matches/group/mod.rs +++ b/espanso-config/src/matches/group/mod.rs @@ -27,23 +27,13 @@ use super::{Match, Variable}; pub(crate) mod loader; mod path; -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Default)] pub(crate) struct MatchGroup { pub imports: Vec, pub global_vars: Vec, pub matches: Vec, } -impl Default for MatchGroup { - fn default() -> Self { - Self { - imports: Vec::new(), - global_vars: Vec::new(), - matches: Vec::new(), - } - } -} - impl MatchGroup { // TODO: test pub fn load(group_path: &Path) -> Result<(Self, Option)> { diff --git a/espanso-config/src/matches/mod.rs b/espanso-config/src/matches/mod.rs index 8d2a5bb..33fd8e4 100644 --- a/espanso-config/src/matches/mod.rs +++ b/espanso-config/src/matches/mod.rs @@ -132,19 +132,11 @@ pub enum UpperCasingStyle { CapitalizeWords, } -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)] pub struct RegexCause { pub regex: String, } -impl Default for RegexCause { - fn default() -> Self { - Self { - regex: String::new(), - } - } -} - // Effects #[derive(Debug, Clone, PartialEq, Eq, Hash, EnumAsInner)] @@ -186,19 +178,11 @@ impl Default for TextEffect { } } -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)] pub struct ImageEffect { pub path: String, } -impl Default for ImageEffect { - fn default() -> Self { - Self { - path: String::new(), - } - } -} - #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Variable { pub id: StructId,