From 4319534b6b089d4dfd1435363ca8f972a2205cf6 Mon Sep 17 00:00:00 2001 From: Sander Hautvast Date: Wed, 26 Jan 2022 19:10:02 +0100 Subject: [PATCH] another mem replace --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index c665851..0a3c8e0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,7 +32,7 @@ impl List { pub fn pop(&mut self) -> Option { let result; - match &self.head { + match std::mem::replace(&mut self.head, Link::Empty) { Link::Empty => { result = None; }