Make rust more idomatic (#1386)

This commit is contained in:
rongyi 2024-06-13 15:19:21 +08:00 committed by GitHub
parent 0774920d7f
commit 017b95f003
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -23,7 +23,7 @@ fn backtrack(mut state: Vec<i32>, choices: &[i32], selected: &mut [bool], res: &
backtrack(state.clone(), choices, selected, res); backtrack(state.clone(), choices, selected, res);
// 回退:撤销选择,恢复到之前的状态 // 回退:撤销选择,恢复到之前的状态
selected[i] = false; selected[i] = false;
state.remove(state.len() - 1); state.pop();
} }
} }
} }

View file

@ -27,7 +27,7 @@ fn backtrack(mut state: Vec<i32>, choices: &[i32], selected: &mut [bool], res: &
backtrack(state.clone(), choices, selected, res); backtrack(state.clone(), choices, selected, res);
// 回退:撤销选择,恢复到之前的状态 // 回退:撤销选择,恢复到之前的状态
selected[i] = false; selected[i] = false;
state.remove(state.len() - 1); state.pop();
} }
} }
} }