chore: 删除未使用的 get_board IPC 命令,修复 clippy needless_range_loop 警告

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-31 13:36:42 +08:00
parent dd84ff95d5
commit 8c3289e631
2 changed files with 1 additions and 18 deletions
-17
View File
@@ -110,23 +110,6 @@ pub fn undo(steps: u32, state: State<AppState>) -> Result<(), String> {
Ok(())
}
#[tauri::command]
pub fn get_board(state: State<AppState>) -> Result<Vec<Vec<i32>>, String> {
let board_opt = state.board.lock().map_err(|e| e.to_string())?;
let board = board_opt.as_ref().ok_or("游戏未开始")?;
let mut result = vec![vec![0i32; board.size]; board.size];
for x in 0..board.size {
for y in 0..board.size {
result[x][y] = match board.get(Position::new(x, y)) {
CellState::Empty => 0,
CellState::Occupied(Color::Black) => 1,
CellState::Occupied(Color::White) => 2,
};
}
}
Ok(result)
}
#[tauri::command]
pub fn ai_move(state: State<AppState>) -> Result<Option<(usize, usize)>, String> {
+1 -1
View File
@@ -11,7 +11,7 @@ pub fn run() {
commands::new_game,
commands::place_piece,
commands::undo,
commands::get_board,
commands::ai_move,
commands::get_game_state,
])