Skip to content

Commit e36453a

Browse files
lovelockfrost.wong
and
frost.wong
authored
replace std::mem::replace with std::mem::take according to clippy sugguestion (#1611)
Co-authored-by: frost.wong <[email protected]>
1 parent ac0da11 commit e36453a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

codes/rust/chapter_hashing/hash_map_chaining.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl HashMapChaining {
6363
/* 扩容哈希表 */
6464
fn extend(&mut self) {
6565
// 暂存原哈希表
66-
let buckets_tmp = std::mem::replace(&mut self.buckets, vec![]);
66+
let buckets_tmp = std::mem::take(&mut self.buckets);
6767

6868
// 初始化扩容后的新哈希表
6969
self.capacity *= self.extend_ratio;

0 commit comments

Comments
 (0)