We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ac0da11 commit e36453aCopy full SHA for e36453a
codes/rust/chapter_hashing/hash_map_chaining.rs
@@ -63,7 +63,7 @@ impl HashMapChaining {
63
/* 扩容哈希表 */
64
fn extend(&mut self) {
65
// 暂存原哈希表
66
- let buckets_tmp = std::mem::replace(&mut self.buckets, vec![]);
+ let buckets_tmp = std::mem::take(&mut self.buckets);
67
68
// 初始化扩容后的新哈希表
69
self.capacity *= self.extend_ratio;
0 commit comments