From 840692acce6746e87abd9bce2345d190f35df31f Mon Sep 17 00:00:00 2001 From: rongyi Date: Wed, 15 May 2024 18:16:55 +0800 Subject: [PATCH] Idiomatic rust (#1364) --- codes/rust/chapter_divide_and_conquer/hanota.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codes/rust/chapter_divide_and_conquer/hanota.rs b/codes/rust/chapter_divide_and_conquer/hanota.rs index 705f817b9..92880a0bc 100644 --- a/codes/rust/chapter_divide_and_conquer/hanota.rs +++ b/codes/rust/chapter_divide_and_conquer/hanota.rs @@ -9,7 +9,7 @@ /* 移动一个圆盘 */ fn move_pan(src: &mut Vec, tar: &mut Vec) { // 从 src 顶部拿出一个圆盘 - let pan = src.remove(src.len() - 1); + let pan = src.pop().unwrap(); // 将圆盘放入 tar 顶部 tar.push(pan); }