fix(config): fix clippy warning

This commit is contained in:
Federico Terzi 2021-12-13 23:52:57 +01:00
parent 37893a3f74
commit 243c6604f8
4 changed files with 7 additions and 50 deletions

View File

@ -37,7 +37,7 @@ use thiserror::Error;
const STANDARD_INCLUDES: &[&str] = &["../match/**/[!_]*.yml"]; const STANDARD_INCLUDES: &[&str] = &["../match/**/[!_]*.yml"];
#[derive(Debug, Clone)] #[derive(Debug, Clone, Default)]
pub(crate) struct ResolvedConfig { pub(crate) struct ResolvedConfig {
parsed: ParsedConfig, parsed: ParsedConfig,
@ -52,20 +52,6 @@ pub(crate) struct ResolvedConfig {
filter_exec: Option<Regex>, filter_exec: Option<Regex>,
} }
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 { impl Config for ResolvedConfig {
fn id(&self) -> i32 { fn id(&self) -> i32 {
self.id self.id

View File

@ -701,18 +701,15 @@ impl LegacyConfigSet {
let mut sorted_triggers: Vec<String> = default let mut sorted_triggers: Vec<String> = default
.matches .matches
.iter() .iter()
.flat_map(|t| triggers_for_match(t)) .flat_map(triggers_for_match)
.collect(); .collect();
sorted_triggers.sort(); sorted_triggers.sort();
let mut has_conflicts = Self::list_has_conflicts(&sorted_triggers); let mut has_conflicts = Self::list_has_conflicts(&sorted_triggers);
for s in specific.iter() { for s in specific.iter() {
let mut specific_triggers: Vec<String> = s let mut specific_triggers: Vec<String> =
.matches s.matches.iter().flat_map(triggers_for_match).collect();
.iter()
.flat_map(|t| triggers_for_match(t))
.collect();
specific_triggers.sort(); specific_triggers.sort();
has_conflicts |= Self::list_has_conflicts(&specific_triggers); has_conflicts |= Self::list_has_conflicts(&specific_triggers);
} }

View File

@ -27,23 +27,13 @@ use super::{Match, Variable};
pub(crate) mod loader; pub(crate) mod loader;
mod path; mod path;
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq, Default)]
pub(crate) struct MatchGroup { pub(crate) struct MatchGroup {
pub imports: Vec<String>, pub imports: Vec<String>,
pub global_vars: Vec<Variable>, pub global_vars: Vec<Variable>,
pub matches: Vec<Match>, pub matches: Vec<Match>,
} }
impl Default for MatchGroup {
fn default() -> Self {
Self {
imports: Vec::new(),
global_vars: Vec::new(),
matches: Vec::new(),
}
}
}
impl MatchGroup { impl MatchGroup {
// TODO: test // TODO: test
pub fn load(group_path: &Path) -> Result<(Self, Option<NonFatalErrorSet>)> { pub fn load(group_path: &Path) -> Result<(Self, Option<NonFatalErrorSet>)> {

View File

@ -132,19 +132,11 @@ pub enum UpperCasingStyle {
CapitalizeWords, CapitalizeWords,
} }
#[derive(Debug, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
pub struct RegexCause { pub struct RegexCause {
pub regex: String, pub regex: String,
} }
impl Default for RegexCause {
fn default() -> Self {
Self {
regex: String::new(),
}
}
}
// Effects // Effects
#[derive(Debug, Clone, PartialEq, Eq, Hash, EnumAsInner)] #[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 struct ImageEffect {
pub path: String, pub path: String,
} }
impl Default for ImageEffect {
fn default() -> Self {
Self {
path: String::new(),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Variable { pub struct Variable {
pub id: StructId, pub id: StructId,