Skip to content

Commit

Permalink
replace std::mem::replace with std::mem::take according to clippy sug…
Browse files Browse the repository at this point in the history
…guestion
  • Loading branch information
frost.wong committed Jan 10, 2025
1 parent 2a955f9 commit 0fec17b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion codes/rust/chapter_hashing/hash_map_chaining.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0fec17b

Please sign in to comment.