Skip to content

Commit

Permalink
Turn on clippy.
Browse files Browse the repository at this point in the history
  • Loading branch information
anp committed Feb 22, 2019
1 parent ab2d64b commit c1b9999
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 4 deletions.
Empty file added clippy.toml
Empty file.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(clippy::all)]
#![allow(clippy::unused_unit)]
#![feature(await_macro, futures_api, async_await, integer_atomics, gen_future)]

#[macro_use]
Expand Down Expand Up @@ -89,13 +91,20 @@ impl Composer {
}
}

impl Default for Composer {
fn default() -> Self {
Self::new()
}
}

#[salsa::query_group(ComponentStorage)]
pub trait Components: Runtime {
#[salsa::input]
fn waker(&self) -> Waker;
#[salsa::input]
fn top_level_exit(&self) -> AbortHandle;

// TODO replace this salsa annotation with passing a scope directly
#[salsa::dependencies]
fn surface(&self, parent: ScopeId) -> ();
}
Expand Down
65 changes: 61 additions & 4 deletions src/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,69 @@ async fn handle_events(

use winit::WindowEvent::*;
match event {
CloseRequested => {
info!("close requested. exiting.");
CloseRequested | Destroyed => {
info!("close requested or window destroyed. exiting.");
top_level_exit.abort();
futures::pending!(); // so nothing else in this task fires accidentally
}
_ => {}
Resized(_new_size) => {}
Moved(_new_position) => {}
DroppedFile(_path) => {}
HoveredFile(_path) => {}
HoveredFileCancelled => {}
ReceivedCharacter(_received_char) => {}
Focused(_in_focus) => {}
KeyboardInput {
device_id: _device_id,
input: _input,
} => {}
CursorMoved {
device_id: _device_id,
position: _position,
modifiers: _modifiers,
} => {}
CursorEntered {
device_id: _device_id,
} => {}
CursorLeft {
device_id: _device_id,
} => {}
MouseWheel {
device_id: _device_id,
delta: _delta,
phase: _phase,
modifiers: _modifiers,
} => {}

MouseInput {
device_id: _device_id,
state: _state,
button: _button,
modifiers: _modifiers,
} => {}

TouchpadPressure {
device_id: _device_id,
pressure: _pressure,
stage: _stage,
} => {}

AxisMotion {
device_id: _device_id,
axis: _axis,
value: _value,
} => {}

Refresh => {
// technically unnecessary? it would be nice to only wake
// on state changes
waker.wake();
}

Touch(_touch) => {}
HiDpiFactorChanged(new_factor) => {
info!("DPI factor changed, is now {}", new_factor);
}
}

waker.wake();
Expand Down Expand Up @@ -102,7 +159,7 @@ pub fn surface_impl(compose: Scope) {
let size = window
.get_inner_size()
.unwrap()
.to_physical(device_pixel_ratio as f64);
.to_physical(f64::from(device_pixel_ratio));
DeviceIntSize::new(size.width as i32, size.height as i32)
};

Expand Down

0 comments on commit c1b9999

Please sign in to comment.