Idiomatic rust (#1364)

This commit is contained in:
rongyi 2024-05-15 18:16:55 +08:00 committed by GitHub
parent 9e569cf520
commit 840692acce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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