diff --git a/src/helpers/mod.rs b/src/helpers/mod.rs index 2bbe0ed..5bd5710 100644 --- a/src/helpers/mod.rs +++ b/src/helpers/mod.rs @@ -21,11 +21,7 @@ use winit::{event_loop::EventLoop, window::WindowBuilder}; mod perf_graph; pub use perf_graph::PerfGraph; -pub fn start( - width: u32, - height: u32, - title: &'static str, -) { +pub fn start(width: u32, height: u32, title: &'static str) { // This provides better error messages in debug mode. // It's disabled in release mode so it doesn't bloat up the file size. #[cfg(all(debug_assertions, target_arch = "wasm32"))] @@ -114,12 +110,5 @@ pub fn start( (canvas, window, gl_context, surface) }; - - run( - canvas, - event_loop, - context, - surface, - window, - ); + run(canvas, event_loop, context, surface, window); } diff --git a/src/hid.rs b/src/hid.rs index 974380c..e1a7838 100644 --- a/src/hid.rs +++ b/src/hid.rs @@ -1,16 +1,12 @@ -use core::panic; use nix::{ fcntl::{FcntlArg, OFlag}, sys::epoll, }; use std::{ collections::VecDeque, - io, os::fd::{AsRawFd, FromRawFd, OwnedFd}, }; -use evdev; - const LASER_POINTER_MAX: i32 = 121; #[derive(Debug)] pub enum Beo5Event { @@ -93,7 +89,7 @@ impl Beo5Device { } } Err(x) => { - if (x.kind() == std::io::ErrorKind::WouldBlock) { + if x.kind() == std::io::ErrorKind::WouldBlock { // Wait forever for bytes available on raw_fd let mut events = [epoll::EpollEvent::empty(); 2]; epoll::epoll_wait(8, &mut events, -1); @@ -107,7 +103,7 @@ impl Beo5Device { if ev.is_some() { return Beo5Device::parse_event(ev.unwrap()); } - return None; + None } fn parse_event(ev: evdev::InputEvent) -> Option { @@ -177,6 +173,6 @@ impl Beo5Device { } _ => {} //SYN et al } - return None; + None } } diff --git a/src/main.rs b/src/main.rs index ae8efaf..b87828d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,5 @@ use femtovg::{ - renderer::OpenGl, Align, Baseline, Canvas, Color, FontId, ImageFlags, ImageId, Paint, Path, - Renderer, + renderer::OpenGl, Align, Baseline, Canvas, Color, FontId, ImageId, Paint, Path, Renderer, }; use instant::Instant; use resource::resource; @@ -75,7 +74,7 @@ fn run( let mut t = 0; el.run(move |event, _, control_flow| { - t = t + 1; + t += 1; *control_flow = ControlFlow::Poll; let hw_event = beo_device.get_event_nonblocking(); diff --git a/src/roundy_math.rs b/src/roundy_math.rs index a36ad2d..cc29c6d 100644 --- a/src/roundy_math.rs +++ b/src/roundy_math.rs @@ -55,7 +55,7 @@ impl VirtualCircle { pub fn get_x_on_circle(&self, y: f32) -> f32 { // Given an x coordinate, return the y coordinate so that it lies on the circle - let x = self.center.x - (self.radius.powf(2.) - (y - self.center.y).powf(2.)).sqrt(); - x as f32 + + self.center.x - (self.radius.powf(2.) - (y - self.center.y).powf(2.)).sqrt() } } diff --git a/src/ui.rs b/src/ui.rs index 53d6dee..b54a092 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -50,12 +50,7 @@ impl Beo { paint_title.set_text_baseline(Baseline::Top); paint_title.set_text_align(Align::Center); paint_title.set_font_size(20.); - let _ = canvas.fill_text( - CANVAS_WIDTH / 2., - 10., - format!("{}", selected_app.name()), - &paint_title, - ); + let _ = canvas.fill_text(CANVAS_WIDTH / 2., 10., selected_app.name(), &paint_title); } } @@ -75,7 +70,7 @@ impl Beo { return Some(i); } } - return None; + None } fn draw_main_menu(&self, canvas: &mut Canvas, fonts: &Fonts) { @@ -109,19 +104,9 @@ impl Beo { paint_selected.set_text_baseline(Baseline::Top); for i in 0..apps.len() { if self.lasered_application_id() == Some(i) { - let _ = canvas.fill_text( - pts[i].x as f32, - pts[i].y as f32, - format!("{}", apps[i].name()), - &paint_selected, - ); + let _ = canvas.fill_text(pts[i].x, pts[i].y, apps[i].name(), &paint_selected); } else { - let _ = canvas.fill_text( - pts[i].x as f32, - pts[i].y as f32, - format!("{}", apps[i].name()), - &paint_normal, - ); + let _ = canvas.fill_text(pts[i].x, pts[i].y, apps[i].name(), &paint_normal); } }