From 556af1624c025e9b0ff6bea8fb5611edbc3a7968 Mon Sep 17 00:00:00 2001 From: rongyi Date: Wed, 27 Mar 2024 01:29:43 +0800 Subject: [PATCH] No need to match expand pop, just return it (#1154) --- codes/rust/chapter_stack_and_queue/array_stack.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/codes/rust/chapter_stack_and_queue/array_stack.rs b/codes/rust/chapter_stack_and_queue/array_stack.rs index ca136c563..4aab6dc2b 100644 --- a/codes/rust/chapter_stack_and_queue/array_stack.rs +++ b/codes/rust/chapter_stack_and_queue/array_stack.rs @@ -36,10 +36,7 @@ impl ArrayStack { /* 出栈 */ fn pop(&mut self) -> Option { - match self.stack.pop() { - Some(num) => Some(num), - None => None, - } + self.stack.pop() } /* 访问栈顶元素 */