Skip to content

Commit 6607cae

Browse files
authored
use remove_piecetype (#12)
1 parent 98f5e3b commit 6607cae

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/chess/position.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,11 @@ impl Position {
261261

262262
// move the enemy pawn
263263
let enemy_pawn = self.piece_at(enemy_sq);
264-
self.remove_piece(!self.stm, enemy_pawn, enemy_sq);
264+
self.remove_piecetype(!self.stm, PieceType::Pawn, enemy_sq);
265265
self.place_piece(!self.stm, enemy_pawn, ep);
266266

267267
// remove our pawn
268-
self.remove_piece(self.stm, piece, to);
268+
self.remove_piecetype(self.stm, PieceType::Pawn, to);
269269

270270
// check if the side which made the move is in check
271271
let is_checked = self.is_checked(!self.stm);
@@ -274,7 +274,7 @@ impl Position {
274274

275275
// move the enemy pawn
276276
self.place_piece(!self.stm, enemy_pawn, enemy_sq);
277-
self.remove_piece(!self.stm, enemy_pawn, ep);
277+
self.remove_piecetype(!self.stm, PieceType::Pawn, ep);
278278

279279
// place our pawn
280280
self.place_piece(self.stm, piece, to);
@@ -350,6 +350,7 @@ impl Position {
350350

351351
/// Removes a piece from the board
352352
#[inline(always)]
353+
#[allow(dead_code)]
353354
fn remove_piece(&mut self, side: Color, pc: Piece, sq: Square) {
354355
debug_assert!(pc != Piece::none());
355356
debug_assert!(sq != Square::NONE);

0 commit comments

Comments
 (0)