From 4fa747bf7548d8fc283a9cc888002161be284071 Mon Sep 17 00:00:00 2001 From: Crilluz Date: Sat, 17 Feb 2024 17:54:30 +0100 Subject: [PATCH] Removed unnecessary function 'is_empty' --- src/rules/game_tile.rs | 7 +------ src/rules/tests.rs | 7 ------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/rules/game_tile.rs b/src/rules/game_tile.rs index 70a03b1..d553a7a 100644 --- a/src/rules/game_tile.rs +++ b/src/rules/game_tile.rs @@ -12,10 +12,6 @@ pub enum Tile { } impl Tile { - pub fn is_empty(t: Tile) -> bool { - return t == Tile::Empty; - } - pub fn get_possible_moves(b: &Board, aggr: bool, cur_pos: (i8, i8)) -> Vec<(i8, i8)> { let boardstate = b.get_state(); let mut movelist: Vec<(i8, i8)> = Vec::new(); @@ -51,7 +47,6 @@ impl Tile { return movelist; } - //This is ugly but eh. pub fn is_valid(board: &Board, cur_pos: (i8, i8), new_pos: (i8, i8), aggr: bool) -> bool { let state = board.get_state(); @@ -147,7 +142,7 @@ impl Tile { let cur_tile = b.to_owned().get_state()[cur_pos.0 as usize][cur_pos.1 as usize]; - if Tile::is_empty(cur_tile) { + if cur_tile == Tile::Empty { eprintln!("\nwtf are you doing? That's not a rock!\n"); } diff --git a/src/rules/tests.rs b/src/rules/tests.rs index b842ffd..e255023 100644 --- a/src/rules/tests.rs +++ b/src/rules/tests.rs @@ -942,13 +942,6 @@ fn add_player_disallow_joins(){ assert!(!g.add_player(String::from("b"), Some(Tile::White))); } -#[test] -fn is_empty_test() { - assert!(Tile::is_empty(Tile::Empty)); - assert!(!Tile::is_empty(Tile::White)); - assert!(!Tile::is_empty(Tile::Black)); -} - #[test] fn diagonal_push_1(){ let state: [[Tile; 4]; 4] = [