mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 15:21:05 +00:00
Apply some clippy lints (#11154)
* Apply some clippy hints * Revert clippy ci changes * Update client/cli/src/commands/generate.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/cli/src/commands/inspect_key.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/db/src/bench.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/db/src/bench.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/service/src/client/block_rules.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/service/src/client/block_rules.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/network/src/transactions.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/network/src/protocol.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Revert due to missing `or_default` function. * Fix compilation and simplify code * Undo change that corrupts benchmark. * fix clippy * Update client/service/test/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/state-db/src/noncanonical.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/state-db/src/noncanonical.rs remove leftovers! * Update client/tracing/src/logging/directives.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update utils/fork-tree/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * added needed ref * Update frame/referenda/src/benchmarking.rs * Simplify byte-vec creation * let's just not overlap the ranges * Correction * cargo fmt * Update utils/frame/benchmarking-cli/src/shared/stats.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update utils/frame/benchmarking-cli/src/pallet/command.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update utils/frame/benchmarking-cli/src/pallet/command.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Giles Cope <gilescope@gmail.com>
This commit is contained in:
committed by
GitHub
parent
a990473cf9
commit
b581604aa7
@@ -99,7 +99,7 @@ pub fn generate_random_npos_inputs(
|
||||
|
||||
let mut chosen_candidates = Vec::with_capacity(n_candidates_chosen);
|
||||
chosen_candidates.extend(candidates.choose_multiple(&mut rng, n_candidates_chosen));
|
||||
chosen_candidates.sort();
|
||||
chosen_candidates.sort_unstable();
|
||||
voters.push((id, vote_weight, chosen_candidates));
|
||||
}
|
||||
|
||||
|
||||
@@ -53,11 +53,9 @@ fn main() {
|
||||
let stake_of = |who: &AccountId| -> VoteWeight { *stake_of_tree.get(who).unwrap() };
|
||||
|
||||
let unbalanced_score = {
|
||||
let staked = assignment_ratio_to_staked_normalized(
|
||||
unbalanced.assignments.clone(),
|
||||
&stake_of,
|
||||
)
|
||||
.unwrap();
|
||||
let staked =
|
||||
assignment_ratio_to_staked_normalized(unbalanced.assignments, &stake_of)
|
||||
.unwrap();
|
||||
let score = to_supports(staked.as_ref()).evaluate();
|
||||
|
||||
if score.minimal_stake == 0 {
|
||||
@@ -72,11 +70,9 @@ fn main() {
|
||||
seq_phragmen(to_elect, candidates, voters, Some((iterations, 0))).unwrap();
|
||||
|
||||
let balanced_score = {
|
||||
let staked = assignment_ratio_to_staked_normalized(
|
||||
balanced.assignments.clone(),
|
||||
&stake_of,
|
||||
)
|
||||
.unwrap();
|
||||
let staked =
|
||||
assignment_ratio_to_staked_normalized(balanced.assignments, &stake_of)
|
||||
.unwrap();
|
||||
to_supports(staked.as_ref()).evaluate()
|
||||
};
|
||||
|
||||
|
||||
@@ -53,11 +53,9 @@ fn main() {
|
||||
let stake_of = |who: &AccountId| -> VoteWeight { *stake_of_tree.get(who).unwrap() };
|
||||
|
||||
let unbalanced_score = {
|
||||
let staked = assignment_ratio_to_staked_normalized(
|
||||
unbalanced.assignments.clone(),
|
||||
&stake_of,
|
||||
)
|
||||
.unwrap();
|
||||
let staked =
|
||||
assignment_ratio_to_staked_normalized(unbalanced.assignments, &stake_of)
|
||||
.unwrap();
|
||||
let score = to_supports(&staked).evaluate();
|
||||
|
||||
if score.minimal_stake == 0 {
|
||||
@@ -72,8 +70,7 @@ fn main() {
|
||||
|
||||
let balanced_score = {
|
||||
let staked =
|
||||
assignment_ratio_to_staked_normalized(balanced.assignments.clone(), &stake_of)
|
||||
.unwrap();
|
||||
assignment_ratio_to_staked_normalized(balanced.assignments, &stake_of).unwrap();
|
||||
to_supports(staked.as_ref()).evaluate()
|
||||
};
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ fn reduce_and_compare(assignment: &Vec<StakedAssignment<AccountId>>, winners: &V
|
||||
let n = assignment.len() as u32;
|
||||
let m = winners.len() as u32;
|
||||
|
||||
let edges_before = assignment_len(&assignment);
|
||||
let edges_before = assignment_len(assignment);
|
||||
let num_changed = reduce(&mut altered_assignment);
|
||||
let edges_after = edges_before - num_changed;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user