Idiomatic rust (#1364)

pull/1365/head
rongyi 6 months ago committed by GitHub
parent 9e569cf520
commit 840692acce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -9,7 +9,7 @@
/* 移动一个圆盘 */ /* 移动一个圆盘 */
fn move_pan(src: &mut Vec<i32>, tar: &mut Vec<i32>) { fn move_pan(src: &mut Vec<i32>, tar: &mut Vec<i32>) {
// 从 src 顶部拿出一个圆盘 // 从 src 顶部拿出一个圆盘
let pan = src.remove(src.len() - 1); let pan = src.pop().unwrap();
// 将圆盘放入 tar 顶部 // 将圆盘放入 tar 顶部
tar.push(pan); tar.push(pan);
} }

Loading…
Cancel
Save