Skip to content

Commit d0ded53

Browse files
pscottbkchrkianenigma
authored
Improve overall performance (#6699)
* Improve overall performance * Clean up code Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Remove needless :: Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Remove needless :: Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
1 parent 40b0555 commit d0ded53

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

fuzzer/src/submit_solution.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ fn main() {
162162
match mode {
163163
Mode::WeakerSubmission => {
164164
assert_eq!(
165-
call.dispatch_bypass_filter(origin.clone().into()).unwrap_err().error,
165+
call.dispatch_bypass_filter(origin.into()).unwrap_err().error,
166166
DispatchError::Module {
167167
index: 0,
168168
error: 16,

src/benchmarking.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn create_validator_with_nominators<T: Trait>(
6161
let validator_prefs = ValidatorPrefs {
6262
commission: Perbill::from_percent(50),
6363
};
64-
Staking::<T>::validate(RawOrigin::Signed(v_controller.clone()).into(), validator_prefs)?;
64+
Staking::<T>::validate(RawOrigin::Signed(v_controller).into(), validator_prefs)?;
6565
let stash_lookup: <T::Lookup as StaticLookup>::Source = T::Lookup::unlookup(v_stash.clone());
6666

6767
points_total += 10;
@@ -375,7 +375,7 @@ benchmarks! {
375375
for _ in 0 .. l {
376376
staking_ledger.unlocking.push(unlock_chunk.clone())
377377
}
378-
Ledger::<T>::insert(controller.clone(), staking_ledger.clone());
378+
Ledger::<T>::insert(controller, staking_ledger);
379379
let slash_amount = T::Currency::minimum_balance() * 10.into();
380380
let balance_before = T::Currency::free_balance(&stash);
381381
}: {

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1626,7 +1626,7 @@ decl_module! {
16261626
let era = Self::current_era().unwrap_or(0) + T::BondingDuration::get();
16271627
ledger.unlocking.push(UnlockChunk { value, era });
16281628
Self::update_ledger(&controller, &ledger);
1629-
Self::deposit_event(RawEvent::Unbonded(ledger.stash.clone(), value));
1629+
Self::deposit_event(RawEvent::Unbonded(ledger.stash, value));
16301630
}
16311631
}
16321632

src/slashing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ fn slash_nominators<T: Trait>(
370370
let mut era_slash = <Module<T> as Store>::NominatorSlashInEra::get(
371371
&slash_era,
372372
stash,
373-
).unwrap_or(Zero::zero());
373+
).unwrap_or_else(|| Zero::zero());
374374

375375
era_slash += own_slash_difference;
376376

src/testing_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ pub fn get_weak_solution<T: Trait>(
158158

159159
// self stake
160160
<Validators<T>>::iter().for_each(|(who, _p)| {
161-
*backing_stake_of.entry(who.clone()).or_insert(Zero::zero()) +=
161+
*backing_stake_of.entry(who.clone()).or_insert_with(|| Zero::zero()) +=
162162
<Module<T>>::slashable_balance_of(&who)
163163
});
164164

0 commit comments

Comments
 (0)