fix(misc): fix new clippy warnings

This commit is contained in:
Federico Terzi 2021-12-11 18:19:56 +01:00
parent 88b9c2ae03
commit 1e92cfef5c
6 changed files with 6 additions and 59 deletions

View File

@ -49,18 +49,11 @@ pub trait Clipboard {
} }
#[allow(dead_code)] #[allow(dead_code)]
#[derive(Default)]
pub struct ClipboardOperationOptions { pub struct ClipboardOperationOptions {
pub use_xclip_backend: bool, pub use_xclip_backend: bool,
} }
impl Default for ClipboardOperationOptions {
fn default() -> Self {
Self {
use_xclip_backend: false,
}
}
}
#[allow(dead_code)] #[allow(dead_code)]
pub struct ClipboardOptions { pub struct ClipboardOptions {
// Wayland-only // Wayland-only

View File

@ -89,6 +89,7 @@ impl Default for InjectionOptions {
} }
#[allow(dead_code)] #[allow(dead_code)]
#[derive(Default)]
pub struct InjectorCreationOptions { pub struct InjectorCreationOptions {
// Only relevant in X11 Linux systems, use the EVDEV backend instead of X11. // Only relevant in X11 Linux systems, use the EVDEV backend instead of X11.
pub use_evdev: bool, pub use_evdev: bool,
@ -128,19 +129,6 @@ pub trait KeyboardStateProvider {
fn is_key_pressed(&self, code: u32) -> bool; fn is_key_pressed(&self, code: u32) -> bool;
} }
#[allow(clippy::derivable_impls)]
impl Default for InjectorCreationOptions {
fn default() -> Self {
Self {
use_evdev: false,
evdev_modifiers: None,
evdev_max_modifier_combination_len: None,
evdev_keyboard_rmlvo: None,
keyboard_state_provider: None,
}
}
}
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
pub fn get_injector(_options: InjectorCreationOptions) -> Result<Box<dyn Injector>> { pub fn get_injector(_options: InjectorCreationOptions) -> Result<Box<dyn Injector>> {
info!("using Win32Injector"); info!("using Win32Injector");

View File

@ -72,23 +72,13 @@ impl<Id> RollingMatch<Id> {
} }
} }
#[derive(Default)]
pub struct StringMatchOptions { pub struct StringMatchOptions {
pub case_insensitive: bool, pub case_insensitive: bool,
pub left_word: bool, pub left_word: bool,
pub right_word: bool, pub right_word: bool,
} }
#[allow(clippy::derivable_impls)]
impl Default for StringMatchOptions {
fn default() -> Self {
Self {
case_insensitive: false,
left_word: false,
right_word: false,
}
}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;

View File

@ -74,6 +74,7 @@ pub enum LogMode {
CleanAndAppend, CleanAndAppend,
} }
#[derive(Default)]
pub struct CliModuleArgs { pub struct CliModuleArgs {
pub config_store: Option<Box<dyn ConfigStore>>, pub config_store: Option<Box<dyn ConfigStore>>,
pub match_store: Option<Box<dyn MatchStore>>, pub match_store: Option<Box<dyn MatchStore>>,
@ -84,20 +85,6 @@ pub struct CliModuleArgs {
pub cli_args: Option<ArgMatches<'static>>, pub cli_args: Option<ArgMatches<'static>>,
} }
impl Default for CliModuleArgs {
fn default() -> Self {
Self {
config_store: None,
match_store: None,
is_legacy_config: false,
non_fatal_errors: Vec::new(),
paths: None,
paths_overrides: None,
cli_args: None,
}
}
}
pub struct PathsOverrides { pub struct PathsOverrides {
pub config: Option<PathBuf>, pub config: Option<PathBuf>,
pub runtime: Option<PathBuf>, pub runtime: Option<PathBuf>,

View File

@ -58,11 +58,7 @@ fn convert_to_ui_menu_item(
espanso_engine::event::ui::MenuItem::Sub(sub) => { espanso_engine::event::ui::MenuItem::Sub(sub) => {
espanso_ui::menu::MenuItem::Sub(espanso_ui::menu::SubMenuItem { espanso_ui::menu::MenuItem::Sub(espanso_ui::menu::SubMenuItem {
label: sub.label.clone(), label: sub.label.clone(),
items: sub items: sub.items.iter().map(convert_to_ui_menu_item).collect(),
.items
.iter()
.map(|item| convert_to_ui_menu_item(item))
.collect(),
}) })
} }
espanso_engine::event::ui::MenuItem::Separator => espanso_ui::menu::MenuItem::Separator, espanso_engine::event::ui::MenuItem::Separator => espanso_ui::menu::MenuItem::Separator,

View File

@ -76,18 +76,11 @@ impl KeyStateStore {
} }
} }
#[derive(Default)]
struct KeyState { struct KeyState {
keys: HashMap<u32, KeyStatus>, keys: HashMap<u32, KeyStatus>,
} }
impl Default for KeyState {
fn default() -> Self {
Self {
keys: HashMap::new(),
}
}
}
struct KeyStatus { struct KeyStatus {
pressed_at: Option<Instant>, pressed_at: Option<Instant>,
} }