mirror of
https://github.com/krahets/hello-algo.git
synced 2025-02-02 14:18:47 +08:00
replace std::mem::replace with std::mem::take according to clippy sugguestion
This commit is contained in:
parent
2a955f937c
commit
0fec17b5d9
@ -63,7 +63,7 @@ impl HashMapChaining {
|
|||||||
/* 扩容哈希表 */
|
/* 扩容哈希表 */
|
||||||
fn extend(&mut self) {
|
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;
|
self.capacity *= self.extend_ratio;
|
||||||
|
Loading…
Reference in New Issue
Block a user