Skip to content

Commit ae57f0e

Browse files
committed
fix build
1 parent d11587f commit ae57f0e

File tree

57 files changed

+181
-148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+181
-148
lines changed

src/catalyst-toolbox/catalyst-toolbox/src/bin/cli/rewards/veterans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ pub fn vca_rewards(
143143
min_rankings..=max_rankings_reputation,
144144
rewards_agreement_rate_cutoffs
145145
.into_iter()
146-
.zip(rewards_agreement_rate_modifiers.into_iter())
146+
.zip(rewards_agreement_rate_modifiers)
147147
.collect(),
148148
reputation_agreement_rate_cutoffs
149149
.into_iter()
150-
.zip(reputation_agreement_rate_modifiers.into_iter())
150+
.zip(reputation_agreement_rate_modifiers)
151151
.collect(),
152152
);
153153

src/catalyst-toolbox/catalyst-toolbox/src/recovery/tally.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ mod test {
759759
match proposal.tally {
760760
Tally::Public { result } => {
761761
let results = result.results();
762-
assert_eq!(*results.get(0).unwrap(), 0.into());
762+
assert_eq!(*results.first().unwrap(), 0.into());
763763
assert_eq!(*results.get(1).unwrap(), funds.into());
764764
assert_eq!(*results.get(2).unwrap(), 0.into());
765765
}

src/catalyst-toolbox/catalyst-toolbox/src/rewards/veterans.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub fn calculate_veteran_advisors_incentives(
126126

127127
reputation_eligible_rankings
128128
.into_iter()
129-
.zip(rewards_eligible_rankings.into_iter())
129+
.zip(rewards_eligible_rankings)
130130
.map(|((vca, reputation), (_vca2, reward))| {
131131
assert_eq!(vca, _vca2); // the use of BTreeMaps ensures iteration is consistent
132132
(
@@ -226,11 +226,11 @@ mod tests {
226226
2..=2,
227227
THRESHOLDS
228228
.into_iter()
229-
.zip(REWARDS_DISAGREEMENT_MODIFIERS.into_iter())
229+
.zip(REWARDS_DISAGREEMENT_MODIFIERS)
230230
.collect(),
231231
THRESHOLDS
232232
.into_iter()
233-
.zip(REPUTATION_DISAGREEMENT_MODIFIERS.into_iter())
233+
.zip(REPUTATION_DISAGREEMENT_MODIFIERS)
234234
.collect(),
235235
);
236236
assert!(results.get(VCA_1).is_none());
@@ -255,11 +255,11 @@ mod tests {
255255
1..=1,
256256
THRESHOLDS
257257
.into_iter()
258-
.zip(REWARDS_DISAGREEMENT_MODIFIERS.into_iter())
258+
.zip(REWARDS_DISAGREEMENT_MODIFIERS)
259259
.collect(),
260260
THRESHOLDS
261261
.into_iter()
262-
.zip(REPUTATION_DISAGREEMENT_MODIFIERS.into_iter())
262+
.zip(REPUTATION_DISAGREEMENT_MODIFIERS)
263263
.collect(),
264264
);
265265
let res1 = results.get(VCA_1).unwrap();

src/catalyst-toolbox/catalyst-toolbox/tests/notifications/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub fn sanity_notification() {
3939
let output = std::str::from_utf8(&result.get_output().stdout).unwrap();
4040
let response: CreateMessageResponse = serde_json::from_str(output).unwrap();
4141
println!("{:?}", response);
42-
let id = response.response.messages.get(0).unwrap();
42+
let id = response.response.messages.first().unwrap();
4343
NotificationsVerifier::new(&access_token)
4444
.verify_message_done_with_text(id, &message.to_string());
4545
}

src/catalyst-toolbox/catalyst-toolbox/tests/tally/generator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl VoteRoundGenerator {
225225
let decrypted_tally = DecryptedPrivateTally::new(
226226
results
227227
.into_iter()
228-
.zip(shares.into_iter())
228+
.zip(shares)
229229
.map(|(tally_result, decrypt_shares)| {
230230
DecryptedPrivateTallyProposal {
231231
decrypt_shares,

src/catalyst-toolbox/catalyst-toolbox/tests/tally/main.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ fn tally_ok() {
101101
&generator.block0(),
102102
vote_fragments
103103
.into_iter()
104-
.chain(tally_fragments.into_iter()),
104+
.chain(tally_fragments),
105105
)
106106
.unwrap();
107107

@@ -129,7 +129,7 @@ fn shuffle_tally_ok() {
129129
&generator.block0(),
130130
vote_fragments
131131
.into_iter()
132-
.chain(tally_fragments.into_iter()),
132+
.chain(tally_fragments),
133133
)
134134
.unwrap();
135135

@@ -155,7 +155,7 @@ fn shuffle_tally_ok_private() {
155155
&generator.block0(),
156156
vote_fragments
157157
.into_iter()
158-
.chain(tally_fragments.into_iter()),
158+
.chain(tally_fragments),
159159
)
160160
.unwrap();
161161

@@ -196,7 +196,7 @@ fn wallet_not_in_block0() {
196196
time: jump_to_epoch(0, generator.block0_config()),
197197
fragment,
198198
})))
199-
.chain(tally_fragments.into_iter()),
199+
.chain(tally_fragments),
200200
)
201201
.unwrap();
202202

@@ -242,7 +242,7 @@ fn only_last_vote_is_counted() {
242242
fragment,
243243
})
244244
})
245-
.chain(tally_fragments.into_iter()),
245+
.chain(tally_fragments),
246246
)
247247
.unwrap();
248248

@@ -289,7 +289,7 @@ fn replay_not_counted() {
289289
fragment,
290290
})
291291
})
292-
.chain(tally_fragments.into_iter()),
292+
.chain(tally_fragments),
293293
)
294294
.unwrap();
295295

@@ -325,7 +325,7 @@ fn multi_voteplan_ok() {
325325
&generator.block0(),
326326
vote_fragments
327327
.into_iter()
328-
.chain(tally_fragments.into_iter()),
328+
.chain(tally_fragments),
329329
)
330330
.unwrap();
331331

@@ -355,7 +355,7 @@ fn multi_voteplan_ok_private() {
355355
&generator.block0(),
356356
vote_fragments
357357
.into_iter()
358-
.chain(tally_fragments.into_iter()),
358+
.chain(tally_fragments),
359359
)
360360
.unwrap();
361361

@@ -509,7 +509,7 @@ fn transaction_transfer_does_not_decrease_voting_power() {
509509
&generator.block0(),
510510
vec![transaction, fragment_yes, fragment_no]
511511
.into_iter()
512-
.chain(tally_fragments.into_iter()),
512+
.chain(tally_fragments),
513513
)
514514
.unwrap();
515515

@@ -555,7 +555,7 @@ fn expired_transaction() {
555555
&generator.block0(),
556556
vec![fragment_yes]
557557
.into_iter()
558-
.chain(tally_fragments.into_iter()),
558+
.chain(tally_fragments),
559559
)
560560
.unwrap();
561561

src/chain-libs/chain-impl-mockchain/src/ledger/tests/transaction_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub fn transaction_fail_when_255_outputs() {
2929
address: receiver.address,
3030
value: Value(1),
3131
};
32-
let outputs: Vec<_> = std::iter::repeat(output).take(255).collect();
32+
let outputs: Vec<_> = std::iter::repeat_n(output, 255).collect();
3333

3434
let fragment = TestTxBuilder::new(test_ledger.block0_hash)
3535
.move_to_outputs_from_faucet(&mut test_ledger, &outputs)

src/chain-libs/chain-impl-mockchain/src/setting.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,12 @@ impl Settings {
266266
self.transaction_max_expiry_epochs,
267267
));
268268

269-
if let Some(p) = &self.reward_params { params.push(ConfigParam::RewardParams(p.clone())) };
270-
if let Some(p) = &self.treasury_params { params.push(ConfigParam::TreasuryParams(*p)) };
269+
if let Some(p) = &self.reward_params {
270+
params.push(ConfigParam::RewardParams(p.clone()))
271+
};
272+
if let Some(p) = &self.treasury_params {
273+
params.push(ConfigParam::TreasuryParams(*p))
274+
};
271275

272276
debug_assert_eq!(self, &Settings::new().try_apply(&params).unwrap());
273277

src/chain-libs/chain-impl-mockchain/src/testing/arbitrary/address.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,24 @@ impl Arbitrary for AddressDataValue {
105105
impl ArbitraryAddressDataValueVec {
106106
pub fn utxos(&self) -> Vec<AddressDataValue> {
107107
self.0
108-
.iter().filter(|&x| matches!(x.address_data.kind(), Kind::Single { .. })).cloned()
108+
.iter()
109+
.filter(|&x| matches!(x.address_data.kind(), Kind::Single { .. }))
110+
.cloned()
109111
.collect()
110112
}
111113
pub fn accounts(&self) -> Vec<AddressDataValue> {
112114
self.0
113-
.iter().filter(|&x| matches!(x.address_data.kind(), Kind::Account { .. })).cloned()
115+
.iter()
116+
.filter(|&x| matches!(x.address_data.kind(), Kind::Account { .. }))
117+
.cloned()
114118
.collect()
115119
}
116120

117121
pub fn delegations(&self) -> Vec<AddressDataValue> {
118122
self.0
119-
.iter().filter(|&x| matches!(x.address_data.kind(), Kind::Group { .. })).cloned()
123+
.iter()
124+
.filter(|&x| matches!(x.address_data.kind(), Kind::Group { .. }))
125+
.cloned()
120126
.collect()
121127
}
122128
}

src/chain-libs/chain-impl-mockchain/src/testing/arbitrary/transaction.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,9 @@ impl AccountStatesVerifier {
189189
let snapshot: Vec<AddressDataValue> = self
190190
.0
191191
.addresses
192-
.iter().filter(|&x| filter_accounts(x)).cloned()
192+
.iter()
193+
.filter(|&x| filter_accounts(x))
194+
.cloned()
193195
.map(|x| find_equal_and_sub(x, inputs))
194196
.collect();
195197

@@ -229,7 +231,9 @@ impl AccountStatesVerifier {
229231

230232
fn find_equal_and_sub(x: AddressDataValue, collection: &[AddressDataValue]) -> AddressDataValue {
231233
match collection
232-
.iter().find(|&y| y.address_data == x.address_data).cloned()
234+
.iter()
235+
.find(|&y| y.address_data == x.address_data)
236+
.cloned()
233237
{
234238
Some(y) => AddressDataValue::new(x.address_data, (x.value - y.value).unwrap()),
235239
None => x,
@@ -238,7 +242,9 @@ fn find_equal_and_sub(x: AddressDataValue, collection: &[AddressDataValue]) -> A
238242

239243
fn find_equal_and_add(x: AddressDataValue, collection: &[AddressDataValue]) -> AddressDataValue {
240244
match collection
241-
.iter().find(|&y| y.address_data == x.address_data).cloned()
245+
.iter()
246+
.find(|&y| y.address_data == x.address_data)
247+
.cloned()
242248
{
243249
Some(y) => AddressDataValue::new(x.address_data, (x.value + y.value).unwrap()),
244250
None => x,
@@ -269,11 +275,14 @@ impl UtxoVerifier {
269275
let outputs = &self.0.output_addresses;
270276

271277
let utxo_not_changed: Vec<AddressDataValue> = all
272-
.iter().filter(|&x| filter_utxo(x)).cloned()
273-
.filter(|x| !inputs.contains(x))
278+
.iter()
279+
.filter(|&x| filter_utxo(x)).filter(|&x| !inputs.contains(x)).cloned()
280+
.collect();
281+
let utxo_added: Vec<AddressDataValue> = outputs
282+
.iter()
283+
.filter(|&x| filter_utxo(x))
284+
.cloned()
274285
.collect();
275-
let utxo_added: Vec<AddressDataValue> =
276-
outputs.iter().filter(|&x| filter_utxo(x)).cloned().collect();
277286

278287
let mut snapshot = Vec::new();
279288
snapshot.extend(utxo_not_changed);

0 commit comments

Comments
 (0)