From c344049fd3c4fc151b173464a0579e3d3a99932d Mon Sep 17 00:00:00 2001 From: Yash Karandikar Date: Sun, 6 Mar 2022 13:08:05 -0600 Subject: [PATCH] Rustfmt --- src/lib.rs | 20 ++++++++++++-------- src/main.rs | 13 +++++++++---- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 1656937..217729e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,11 +1,14 @@ use std::cell::Cell; -use sdl2::{video::{WindowBuildError, Window}, IntegerOrSdlError, render::Canvas, EventPump}; +use sdl2::{ + render::Canvas, + video::{Window, WindowBuildError}, + EventPump, IntegerOrSdlError, +}; -pub use sdl2::pixels::Color; -pub use sdl2::keyboard::Keycode; pub use sdl2::event::Event; - +pub use sdl2::keyboard::Keycode; +pub use sdl2::pixels::Color; #[derive(Debug)] pub struct CatboxError(String); @@ -34,7 +37,7 @@ pub struct Game { pub title: String, pub width: u32, pub height: u32, - stopped: Cell + stopped: Cell, } impl Game { @@ -43,7 +46,7 @@ impl Game { title: title.to_string(), width, height, - stopped: Cell::new(false) + stopped: Cell::new(false), } } @@ -51,7 +54,8 @@ impl Game { let sdl_context = sdl2::init()?; let video_subsystem = sdl_context.video()?; - let window = video_subsystem.window(&self.title, self.width, self.height) + let window = video_subsystem + .window(&self.title, self.width, self.height) .position_centered() .build()?; @@ -73,4 +77,4 @@ impl Game { pub fn terminate(&self) { self.stopped.set(true); } -} \ No newline at end of file +} diff --git a/src/main.rs b/src/main.rs index a6080c0..0eb0f95 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use catbox::{Game, Keycode, Event}; +use catbox::{Event, Game, Keycode}; fn main() { let mut game = Game::new("catbox demo", 1000, 800); @@ -8,9 +8,14 @@ fn main() { canvas.clear(); for event in event_pump.poll_iter() { match event { - Event::Quit {..} | Event::KeyDown { keycode: Some(Keycode::Escape), .. } => game.terminate(), + Event::Quit { .. } + | Event::KeyDown { + keycode: Some(Keycode::Escape), + .. + } => game.terminate(), _ => {} } } - }).unwrap(); -} \ No newline at end of file + }) + .unwrap(); +}