refactor: use index<usize> in index<Position> implementation

This commit is contained in:
2026-08-12 00:48:47 +02:00
parent 0d1a9cafbb
commit 990c133bc6

View File

@@ -121,8 +121,7 @@ impl Index<Position> for Board {
type Output = Field;
fn index(&self, index: Position) -> &Self::Output {
let index = index.row * &self.size + index.column;
&self.board[index]
&self[index.row][index.column]
}
}
@@ -136,8 +135,7 @@ impl IndexMut<usize> for Board {
impl IndexMut<Position> for Board {
fn index_mut(&mut self, index: Position) -> &mut Self::Output {
let index = index.row * &self.size + index.column;
&mut self.board[index]
&mut self[index.row][index.column]
}
}