minor styles

master
Edward Shen 2020-03-22 22:44:27 -04:00
parent 2aa1602dc1
commit 7fab1b2cce
Signed by: edward
GPG Key ID: 19182661E818369F
2 changed files with 4 additions and 8 deletions

View File

@ -136,8 +136,7 @@ impl Game {
// It's possible that the player moved the piece in the meantime.
if !self.playfield.can_active_piece_move_down() {
let positions = self.playfield.lock_active_piece();
self.is_game_over =
self.is_game_over || positions.iter().all(|Position { x: _, y }| *y < 20);
self.is_game_over = self.is_game_over || positions.iter().map(|p| p.y).all(|y| y < 20);
if self.clear_lines() > 0 {
self.playfield.active_piece = None;
@ -227,9 +226,6 @@ impl Controllable for Game {
}
fn hold(&mut self) {
match self.playfield.try_swap_hold() {
Ok(_) => {}
Err(_) => (),
}
let _ = self.playfield.try_swap_hold();
}
}

View File

@ -1,5 +1,5 @@
use crate::playfield::{Matrix, PlayField};
use crate::tetromino::{Position, RotationState, Tetromino, TetrominoType};
use crate::playfield::PlayField;
use crate::tetromino::{Position, RotationState, TetrominoType};
use std::collections::HashMap;
pub trait RotationSystem {