mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 14:01:02 +00:00
declone and close the door (#12035)
* declone and close the door * cargo fmt * remove brackets
This commit is contained in:
@@ -233,7 +233,7 @@ fn phragmen_poc_works() {
|
||||
candidates,
|
||||
voters
|
||||
.iter()
|
||||
.map(|(ref v, ref vs)| (v.clone(), stake_of(v), vs.clone()))
|
||||
.map(|(ref v, ref vs)| (*v, stake_of(v), vs.clone()))
|
||||
.collect::<Vec<_>>(),
|
||||
None,
|
||||
)
|
||||
@@ -289,7 +289,7 @@ fn phragmen_poc_works_with_balancing() {
|
||||
candidates,
|
||||
voters
|
||||
.iter()
|
||||
.map(|(ref v, ref vs)| (v.clone(), stake_of(v), vs.clone()))
|
||||
.map(|(ref v, ref vs)| (*v, stake_of(v), vs.clone()))
|
||||
.collect::<Vec<_>>(),
|
||||
Some(config),
|
||||
)
|
||||
@@ -376,7 +376,7 @@ fn phragmen_accuracy_on_large_scale_only_candidates() {
|
||||
candidates.clone(),
|
||||
auto_generate_self_voters(&candidates)
|
||||
.iter()
|
||||
.map(|(ref v, ref vs)| (v.clone(), stake_of(v), vs.clone()))
|
||||
.map(|(ref v, ref vs)| (*v, stake_of(v), vs.clone()))
|
||||
.collect::<Vec<_>>(),
|
||||
None,
|
||||
)
|
||||
@@ -407,7 +407,7 @@ fn phragmen_accuracy_on_large_scale_voters_and_candidates() {
|
||||
candidates,
|
||||
voters
|
||||
.iter()
|
||||
.map(|(ref v, ref vs)| (v.clone(), stake_of(v), vs.clone()))
|
||||
.map(|(ref v, ref vs)| (*v, stake_of(v), vs.clone()))
|
||||
.collect::<Vec<_>>(),
|
||||
None,
|
||||
)
|
||||
@@ -439,7 +439,7 @@ fn phragmen_accuracy_on_small_scale_self_vote() {
|
||||
candidates,
|
||||
voters
|
||||
.iter()
|
||||
.map(|(ref v, ref vs)| (v.clone(), stake_of(v), vs.clone()))
|
||||
.map(|(ref v, ref vs)| (*v, stake_of(v), vs.clone()))
|
||||
.collect::<Vec<_>>(),
|
||||
None,
|
||||
)
|
||||
@@ -469,7 +469,7 @@ fn phragmen_accuracy_on_small_scale_no_self_vote() {
|
||||
candidates,
|
||||
voters
|
||||
.iter()
|
||||
.map(|(ref v, ref vs)| (v.clone(), stake_of(v), vs.clone()))
|
||||
.map(|(ref v, ref vs)| (*v, stake_of(v), vs.clone()))
|
||||
.collect::<Vec<_>>(),
|
||||
None,
|
||||
)
|
||||
@@ -505,7 +505,7 @@ fn phragmen_large_scale_test() {
|
||||
candidates,
|
||||
voters
|
||||
.iter()
|
||||
.map(|(ref v, ref vs)| (v.clone(), stake_of(v), vs.clone()))
|
||||
.map(|(ref v, ref vs)| (*v, stake_of(v), vs.clone()))
|
||||
.collect::<Vec<_>>(),
|
||||
None,
|
||||
)
|
||||
@@ -532,7 +532,7 @@ fn phragmen_large_scale_test_2() {
|
||||
candidates,
|
||||
voters
|
||||
.iter()
|
||||
.map(|(ref v, ref vs)| (v.clone(), stake_of(v), vs.clone()))
|
||||
.map(|(ref v, ref vs)| (*v, stake_of(v), vs.clone()))
|
||||
.collect::<Vec<_>>(),
|
||||
None,
|
||||
)
|
||||
@@ -601,7 +601,7 @@ fn elect_has_no_entry_barrier() {
|
||||
candidates,
|
||||
voters
|
||||
.iter()
|
||||
.map(|(ref v, ref vs)| (v.clone(), stake_of(v), vs.clone()))
|
||||
.map(|(ref v, ref vs)| (*v, stake_of(v), vs.clone()))
|
||||
.collect::<Vec<_>>(),
|
||||
None,
|
||||
)
|
||||
@@ -622,7 +622,7 @@ fn phragmen_self_votes_should_be_kept() {
|
||||
candidates,
|
||||
voters
|
||||
.iter()
|
||||
.map(|(ref v, ref vs)| (v.clone(), stake_of(v), vs.clone()))
|
||||
.map(|(ref v, ref vs)| (*v, stake_of(v), vs.clone()))
|
||||
.collect::<Vec<_>>(),
|
||||
None,
|
||||
)
|
||||
@@ -872,30 +872,15 @@ mod score {
|
||||
let claim =
|
||||
[12488167277027543u128, 5559266368032409496, 118700736389524721358337889258988054];
|
||||
|
||||
assert_eq!(
|
||||
is_score_better(claim.clone(), initial.clone(), Perbill::from_rational(1u32, 10_000),),
|
||||
true,
|
||||
);
|
||||
assert_eq!(is_score_better(claim, initial, Perbill::from_rational(1u32, 10_000),), true,);
|
||||
|
||||
assert_eq!(
|
||||
is_score_better(claim.clone(), initial.clone(), Perbill::from_rational(2u32, 10_000),),
|
||||
true,
|
||||
);
|
||||
assert_eq!(is_score_better(claim, initial, Perbill::from_rational(2u32, 10_000),), true,);
|
||||
|
||||
assert_eq!(
|
||||
is_score_better(claim.clone(), initial.clone(), Perbill::from_rational(3u32, 10_000),),
|
||||
true,
|
||||
);
|
||||
assert_eq!(is_score_better(claim, initial, Perbill::from_rational(3u32, 10_000),), true,);
|
||||
|
||||
assert_eq!(
|
||||
is_score_better(claim.clone(), initial.clone(), Perbill::from_rational(4u32, 10_000),),
|
||||
true,
|
||||
);
|
||||
assert_eq!(is_score_better(claim, initial, Perbill::from_rational(4u32, 10_000),), true,);
|
||||
|
||||
assert_eq!(
|
||||
is_score_better(claim.clone(), initial.clone(), Perbill::from_rational(5u32, 10_000),),
|
||||
false,
|
||||
);
|
||||
assert_eq!(is_score_better(claim, initial, Perbill::from_rational(5u32, 10_000),), false,);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user