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"];
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
pub(crate) struct ResolvedConfig {
parsed: ParsedConfig,
@ -52,20 +52,6 @@ pub(crate) struct ResolvedConfig {
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 {
fn id(&self) -> i32 {
self.id

View File

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

View File

@ -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<String>,
pub global_vars: Vec<Variable>,
pub matches: Vec<Match>,
}
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<NonFatalErrorSet>)> {

View File

@ -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,