diff --git a/src/ledger/src/data_model/effects.rs b/src/ledger/src/data_model/effects.rs index e086a2034..494edbef2 100644 --- a/src/ledger/src/data_model/effects.rs +++ b/src/ledger/src/data_model/effects.rs @@ -287,7 +287,7 @@ impl TxnEffect { // (1), within this transaction //let v = vec![]; - let iss_nums = self.new_issuance_nums.entry(code).or_insert_with(Vec::new); + let iss_nums = self.new_issuance_nums.entry(code).or_default(); if let Some(last_num) = iss_nums.last() { if seq_num <= *last_num { diff --git a/src/ledger/src/staking/mod.rs b/src/ledger/src/staking/mod.rs index 7a42430b2..de471b8d2 100644 --- a/src/ledger/src/staking/mod.rs +++ b/src/ledger/src/staking/mod.rs @@ -809,7 +809,7 @@ impl Staking { self.delegation_info .end_height_map .entry(end_height) - .or_insert_with(BTreeSet::new) + .or_default() .insert(owner); // There should be no failure here !! @@ -903,7 +903,7 @@ impl Staking { self.delegation_info .end_height_map .entry(h + CFG.checkpoint.unbond_block_cnt) - .or_insert_with(BTreeSet::new) + .or_default() .insert(*addr); } @@ -995,7 +995,7 @@ impl Staking { self.delegation_info .end_height_map .entry(h + CFG.checkpoint.unbond_block_cnt) - .or_insert_with(BTreeSet::new) + .or_default() .insert(pu.new_delegator_id); // update delegator entries for pu target_validator @@ -1078,7 +1078,7 @@ impl Staking { self.delegation_info .end_height_map .entry(end_height) - .or_insert_with(BTreeSet::new) + .or_default() .insert(addr.to_owned()); Ok(()) } else {