Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Avoid redundant clone. (#6989)
Browse files Browse the repository at this point in the history
Co-authored-by: eskimor <[email protected]>
  • Loading branch information
eskimor and eskimor authored Mar 31, 2023
1 parent 715631d commit 4659387
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions runtime/parachains/src/paras_inherent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ where
/// as well as their indices in ascending order.
fn random_sel<X, F: Fn(&X) -> Weight>(
rng: &mut rand_chacha::ChaChaRng,
selectables: Vec<X>,
selectables: &[X],
mut preferred_indices: Vec<usize>,
weight_fn: F,
weight_limit: Weight,
Expand Down Expand Up @@ -892,7 +892,7 @@ fn apply_weight_limit<T: Config + inclusion::Config>(
let (acc_candidate_weight, indices) =
random_sel::<BackedCandidate<<T as frame_system::Config>::Hash>, _>(
rng,
candidates.clone(),
&candidates,
preferred_indices,
|c| backed_candidate_weight::<T>(c),
max_consumable_by_candidates,
Expand All @@ -911,7 +911,7 @@ fn apply_weight_limit<T: Config + inclusion::Config>(
// into the block and skip the candidates entirely
let (total_consumed, indices) = random_sel::<UncheckedSignedAvailabilityBitfield, _>(
rng,
bitfields.clone(),
&bitfields,
vec![],
|_| <<T as Config>::WeightInfo as WeightInfo>::enter_bitfields(),
max_consumable_weight,
Expand Down Expand Up @@ -1282,7 +1282,7 @@ fn limit_and_sanitize_disputes<
// Select remote disputes at random until the block is full
let (_acc_remote_disputes_weight, mut indices) = random_sel::<u32, _>(
rng,
d,
&d,
vec![],
|v| <<T as Config>::WeightInfo as WeightInfo>::enter_variable_disputes(*v),
max_consumable_weight.saturating_sub(weight_acc),
Expand Down

0 comments on commit 4659387

Please sign in to comment.