Skip to content

Commit 017b95f

Browse files
authored
Make rust more idomatic (#1386)
1 parent 0774920 commit 017b95f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

codes/rust/chapter_backtracking/permutations_i.rs

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

codes/rust/chapter_backtracking/permutations_ii.rs

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

0 commit comments

Comments
 (0)