Fix clippy issues

Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
This commit is contained in:
Christian Duerr 2020-08-06 01:09:46 +00:00 committed by GitHub
parent 291de2500f
commit c478a9fc52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 23 deletions

View File

@ -1017,18 +1017,18 @@ impl<N: Notify + OnResize> Processor<N> {
/// Check if an event is irrelevant and can be skipped. /// Check if an event is irrelevant and can be skipped.
fn skip_event(event: &GlutinEvent<Event>) -> bool { fn skip_event(event: &GlutinEvent<Event>) -> bool {
match event { match event {
GlutinEvent::WindowEvent { event, .. } => match event { GlutinEvent::WindowEvent { event, .. } => matches!(
event,
WindowEvent::KeyboardInput { is_synthetic: true, .. } WindowEvent::KeyboardInput { is_synthetic: true, .. }
| WindowEvent::TouchpadPressure { .. } | WindowEvent::TouchpadPressure { .. }
| WindowEvent::CursorEntered { .. } | WindowEvent::CursorEntered { .. }
| WindowEvent::AxisMotion { .. } | WindowEvent::AxisMotion { .. }
| WindowEvent::HoveredFileCancelled | WindowEvent::HoveredFileCancelled
| WindowEvent::Destroyed | WindowEvent::Destroyed
| WindowEvent::HoveredFile(_) | WindowEvent::HoveredFile(_)
| WindowEvent::Touch(_) | WindowEvent::Touch(_)
| WindowEvent::Moved(_) => true, | WindowEvent::Moved(_)
_ => false, ),
},
GlutinEvent::Suspended { .. } GlutinEvent::Suspended { .. }
| GlutinEvent::NewEvents { .. } | GlutinEvent::NewEvents { .. }
| GlutinEvent::MainEventsCleared | GlutinEvent::MainEventsCleared

View File

@ -244,11 +244,6 @@ impl Window {
#[cfg(not(any(target_os = "macos", windows)))] #[cfg(not(any(target_os = "macos", windows)))]
pub fn get_platform_window(title: &str, window_config: &WindowConfig) -> WindowBuilder { 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) let image = image::load_from_memory_with_format(WINDOW_ICON, ImageFormat::Ico)
.expect("loading icon") .expect("loading icon")
.to_rgba(); .to_rgba();
@ -261,7 +256,7 @@ impl Window {
.with_title(title) .with_title(title)
.with_visible(false) .with_visible(false)
.with_transparent(true) .with_transparent(true)
.with_decorations(decorations) .with_decorations(window_config.decorations != Decorations::None)
.with_maximized(window_config.startup_mode == StartupMode::Maximized) .with_maximized(window_config.startup_mode == StartupMode::Maximized)
.with_window_icon(icon.ok()) .with_window_icon(icon.ok())
// X11. // X11.
@ -278,17 +273,12 @@ impl Window {
#[cfg(windows)] #[cfg(windows)]
pub fn get_platform_window(title: &str, window_config: &WindowConfig) -> WindowBuilder { 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); let icon = Icon::from_resource(IDI_ICON, None);
WindowBuilder::new() WindowBuilder::new()
.with_title(title) .with_title(title)
.with_visible(false) .with_visible(false)
.with_decorations(decorations) .with_decorations(window_config.decorations != Decorations::None)
.with_transparent(true) .with_transparent(true)
.with_maximized(window_config.startup_mode == StartupMode::Maximized) .with_maximized(window_config.startup_mode == StartupMode::Maximized)
.with_window_icon(icon.ok()) .with_window_icon(icon.ok())