From e36453ac25596530ea8eae490859571c1cc8f102 Mon Sep 17 00:00:00 2001 From: Frost Wong Date: Sun, 26 Jan 2025 06:09:26 +0800 Subject: [PATCH] replace std::mem::replace with std::mem::take according to clippy sugguestion (#1611) Co-authored-by: frost.wong --- codes/rust/chapter_hashing/hash_map_chaining.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codes/rust/chapter_hashing/hash_map_chaining.rs b/codes/rust/chapter_hashing/hash_map_chaining.rs index 8f081f006..f0773d82d 100644 --- a/codes/rust/chapter_hashing/hash_map_chaining.rs +++ b/codes/rust/chapter_hashing/hash_map_chaining.rs @@ -63,7 +63,7 @@ impl HashMapChaining { /* 扩容哈希表 */ fn extend(&mut self) { // 暂存原哈希表 - let buckets_tmp = std::mem::replace(&mut self.buckets, vec![]); + let buckets_tmp = std::mem::take(&mut self.buckets); // 初始化扩容后的新哈希表 self.capacity *= self.extend_ratio;