Run cargo fmt

This commit is contained in:
Daniel Flanagan 2021-11-15 13:15:27 -06:00
parent 17e6b5c17c
commit 77a12e1c9f
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4

View file

@ -33,9 +33,11 @@ impl Obstacle {
let x = self.x - current_x + X_OFFSET;
let (y_top_of_bottom, y_bottom_of_top) = self.y_bounds();
let y_positions = [0..y_bottom_of_top, y_top_of_bottom..SCREEN_HEIGHT]
.map(|r| { r.collect::<Vec<u16>>() })
.concat();
for y in y_positions { ctx.set(x, y as i32, RED, BLACK, to_cp437('|')); }
.map(|r| r.collect::<Vec<u16>>())
.concat();
for y in y_positions {
ctx.set(x, y as i32, RED, BLACK, to_cp437('|'));
}
}
fn y_bounds(&mut self) -> (u16, u16) {
@ -120,7 +122,7 @@ impl State {
match key {
VirtualKeyCode::P => self.restart(),
VirtualKeyCode::Q => ctx.quitting = true,
_ => {},
_ => {}
}
}
}
@ -172,7 +174,9 @@ impl State {
self.obstacles.iter_mut().for_each(|o| {
if o.x == self.player.x {
let (y_top_of_bottom, y_bottom_of_top) = o.y_bounds();
if (self.player.y as u16) >= y_top_of_bottom || (self.player.y as u16) <= y_bottom_of_top {
if (self.player.y as u16) >= y_top_of_bottom
|| (self.player.y as u16) <= y_bottom_of_top
{
did_collide = true;
}
}
@ -200,7 +204,7 @@ impl State {
match key {
VirtualKeyCode::P => self.restart(),
VirtualKeyCode::Q => ctx.quitting = true,
_ => {},
_ => {}
}
}
}