Make rust more idomatic (#1386)

pull/1399/head
rongyi 5 months ago committed by GitHub
parent 0774920d7f
commit 017b95f003
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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();
} }
} }
} }

@ -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();
} }
} }
} }

Loading…
Cancel
Save