From bd2abeb8deb1d69bfa36e805a313a8a1871aeb0c Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Sat, 11 Dec 2021 17:25:18 +0100 Subject: [PATCH] fix(match): fix clippy warning --- espanso-match/src/regex/mod.rs | 10 +--------- espanso-match/src/rolling/matcher.rs | 10 +--------- espanso-match/src/rolling/mod.rs | 1 + 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/espanso-match/src/regex/mod.rs b/espanso-match/src/regex/mod.rs index 560f513..b05e5ca 100644 --- a/espanso-match/src/regex/mod.rs +++ b/espanso-match/src/regex/mod.rs @@ -40,19 +40,11 @@ impl RegexMatch { } } -#[derive(Clone)] +#[derive(Clone, Default)] pub struct RegexMatcherState { buffer: String, } -impl Default for RegexMatcherState { - fn default() -> Self { - Self { - buffer: String::new(), - } - } -} - pub struct RegexMatcherOptions { pub max_buffer_size: usize, } diff --git a/espanso-match/src/rolling/matcher.rs b/espanso-match/src/rolling/matcher.rs index 136bed3..44cbd99 100644 --- a/espanso-match/src/rolling/matcher.rs +++ b/espanso-match/src/rolling/matcher.rs @@ -50,20 +50,12 @@ struct RollingMatcherStatePath<'a, Id> { events: Vec<(Event, IsWordSeparator)>, } +#[derive(Default)] pub struct RollingMatcherOptions { pub char_word_separators: Vec, pub key_word_separators: Vec, } -impl Default for RollingMatcherOptions { - fn default() -> Self { - Self { - char_word_separators: Vec::new(), - key_word_separators: Vec::new(), - } - } -} - pub struct RollingMatcher { char_word_separators: Vec, key_word_separators: Vec, diff --git a/espanso-match/src/rolling/mod.rs b/espanso-match/src/rolling/mod.rs index 57d60b7..d51fb57 100644 --- a/espanso-match/src/rolling/mod.rs +++ b/espanso-match/src/rolling/mod.rs @@ -78,6 +78,7 @@ pub struct StringMatchOptions { pub right_word: bool, } +#[allow(clippy::derivable_impls)] impl Default for StringMatchOptions { fn default() -> Self { Self {