From 76681d40623c8a6b8b48ae1108568ed5b799f7ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Tom=C3=A1s?= Date: Sat, 16 Jan 2021 04:33:09 -0300 Subject: Run cargo fmt for the first time --- src/main.rs | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index bd7e1a2..7424f7a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,16 +1,16 @@ -mod poly; -mod number; mod lerp; +mod number; +mod poly; -use number::Number; use lerp::Lerp; +use number::Number; use std::thread; use std::time::Duration; -use sdl2::pixels::Color; use sdl2::event::Event; use sdl2::keyboard::Keycode; +use sdl2::pixels::Color; use sdl2::rect::Rect; fn main() { @@ -23,7 +23,8 @@ fn main() { let sdl_context = sdl2::init().unwrap(); let video_subsystem = sdl_context.video().unwrap(); - let window = video_subsystem.window("rust-sdl2 demo", 800, 600) + let window = video_subsystem + .window("rust-sdl2 demo", 800, 600) .position_centered() .build() .unwrap(); @@ -36,10 +37,11 @@ fn main() { canvas.clear(); for event in event_pump.poll_iter() { match event { - Event::Quit {..} | - Event::KeyDown { keycode: Some(Keycode::Escape), .. } => { - break 'running - }, + Event::Quit { .. } + | Event::KeyDown { + keycode: Some(Keycode::Escape), + .. + } => break 'running, _ => {} } } @@ -51,13 +53,21 @@ fn main() { let y = k + s * pb.eval(t as Number / 100.0); let z = k + s * p.eval(t as Number / 100.0); canvas.set_draw_color(Color::RGB(180, 20, 20)); - canvas.fill_rect(Rect::new(400 + t, x as i32, 5, 5)).unwrap(); + canvas + .fill_rect(Rect::new(400 + t, x as i32, 5, 5)) + .unwrap(); canvas.set_draw_color(Color::RGB(20, 180, 20)); - canvas.fill_rect(Rect::new(400 + t, y as i32, 5, 5)).unwrap(); + canvas + .fill_rect(Rect::new(400 + t, y as i32, 5, 5)) + .unwrap(); canvas.set_draw_color(Color::RGB(20, 20, 180)); - canvas.fill_rect(Rect::new(400 + t, z as i32, 2, 2)).unwrap(); + canvas + .fill_rect(Rect::new(400 + t, z as i32, 2, 2)) + .unwrap(); canvas.set_draw_color(Color::RGB(255, 0, 0)); - canvas.fill_rect(Rect::new(400 + t, k as i32, 2, 2)).unwrap(); + canvas + .fill_rect(Rect::new(400 + t, k as i32, 2, 2)) + .unwrap(); } canvas.present(); -- cgit v1.2.3