Skip to content

Commit 840692a

Browse files
authored
Idiomatic rust (krahets#1364)
1 parent 9e569cf commit 840692a

File tree

1 file changed

+1
-1
lines changed
  • codes/rust/chapter_divide_and_conquer

1 file changed

+1
-1
lines changed

codes/rust/chapter_divide_and_conquer/hanota.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/* 移动一个圆盘 */
1010
fn move_pan(src: &mut Vec<i32>, tar: &mut Vec<i32>) {
1111
// 从 src 顶部拿出一个圆盘
12-
let pan = src.remove(src.len() - 1);
12+
let pan = src.pop().unwrap();
1313
// 将圆盘放入 tar 顶部
1414
tar.push(pan);
1515
}

0 commit comments

Comments
 (0)