From c478a9fc526828d7d05c7e6189126b47ec4b8122 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Thu, 6 Aug 2020 01:09:46 +0000 Subject: [PATCH] Fix clippy issues Co-authored-by: Kirill Chibisov --- alacritty/src/event.rs | 22 +++++++++++----------- alacritty/src/window.rs | 14 ++------------ 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs index 85dca0ee..9e6dde16 100644 --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -1017,18 +1017,18 @@ impl Processor { /// Check if an event is irrelevant and can be skipped. fn skip_event(event: &GlutinEvent) -> bool { match event { - GlutinEvent::WindowEvent { event, .. } => match event { + GlutinEvent::WindowEvent { event, .. } => matches!( + event, WindowEvent::KeyboardInput { is_synthetic: true, .. } - | WindowEvent::TouchpadPressure { .. } - | WindowEvent::CursorEntered { .. } - | WindowEvent::AxisMotion { .. } - | WindowEvent::HoveredFileCancelled - | WindowEvent::Destroyed - | WindowEvent::HoveredFile(_) - | WindowEvent::Touch(_) - | WindowEvent::Moved(_) => true, - _ => false, - }, + | WindowEvent::TouchpadPressure { .. } + | WindowEvent::CursorEntered { .. } + | WindowEvent::AxisMotion { .. } + | WindowEvent::HoveredFileCancelled + | WindowEvent::Destroyed + | WindowEvent::HoveredFile(_) + | WindowEvent::Touch(_) + | WindowEvent::Moved(_) + ), GlutinEvent::Suspended { .. } | GlutinEvent::NewEvents { .. } | GlutinEvent::MainEventsCleared diff --git a/alacritty/src/window.rs b/alacritty/src/window.rs index bfe7360a..3319dce8 100644 --- a/alacritty/src/window.rs +++ b/alacritty/src/window.rs @@ -244,11 +244,6 @@ impl Window { #[cfg(not(any(target_os = "macos", windows)))] pub fn get_platform_window(title: &str, window_config: &WindowConfig) -> WindowBuilder { - let decorations = match window_config.decorations { - Decorations::None => false, - _ => true, - }; - let image = image::load_from_memory_with_format(WINDOW_ICON, ImageFormat::Ico) .expect("loading icon") .to_rgba(); @@ -261,7 +256,7 @@ impl Window { .with_title(title) .with_visible(false) .with_transparent(true) - .with_decorations(decorations) + .with_decorations(window_config.decorations != Decorations::None) .with_maximized(window_config.startup_mode == StartupMode::Maximized) .with_window_icon(icon.ok()) // X11. @@ -278,17 +273,12 @@ impl Window { #[cfg(windows)] pub fn get_platform_window(title: &str, window_config: &WindowConfig) -> WindowBuilder { - let decorations = match window_config.decorations { - Decorations::None => false, - _ => true, - }; - let icon = Icon::from_resource(IDI_ICON, None); WindowBuilder::new() .with_title(title) .with_visible(false) - .with_decorations(decorations) + .with_decorations(window_config.decorations != Decorations::None) .with_transparent(true) .with_maximized(window_config.startup_mode == StartupMode::Maximized) .with_window_icon(icon.ok())