Skip to content

Commit

Permalink
Fixed 'mithril-stm' clippy warnings from Rust 1.67.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jpraynaud committed Jan 26, 2023
1 parent 585f1f9 commit f8a89a8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion mithril-stm/benches/multi_sig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn batch_benches(c: &mut Criterion, array_batches: &[usize], nr_sigs: usize) {
let mut batch_sig = Vec::new();

for &nr_batches in array_batches {
let batch_string = format!("Batch size: {}", nr_batches);
let batch_string = format!("Batch size: {nr_batches}");

for _ in 0..nr_batches {
let mut msg = [0u8; 32];
Expand Down
2 changes: 1 addition & 1 deletion mithril-stm/benches/size_benches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ where
H: Digest + Clone + Sync + Send + Default + FixedOutput,
{
println!("+-------------------+");
println!("| Hash: {} |", hash_name);
println!("| Hash: {hash_name} |");
println!("+-------------------+");
let mut rng = ChaCha20Rng::from_seed([0u8; 32]);
let mut msg = [0u8; 16];
Expand Down
6 changes: 3 additions & 3 deletions mithril-stm/benches/stm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn stm_benches<H>(c: &mut Criterion, nr_parties: usize, params: StmParameters, h
where
H: Clone + Debug + Digest + Send + Sync + FixedOutput + Default,
{
let mut group = c.benchmark_group(format!("STM/{}", hashing_alg));
let mut group = c.benchmark_group(format!("STM/{hashing_alg}"));
let mut rng = ChaCha20Rng::from_seed([0u8; 32]);
let mut msg = [0u8; 16];
rng.fill_bytes(&mut msg);
Expand Down Expand Up @@ -82,7 +82,7 @@ fn batch_benches<H>(
) where
H: Clone + Debug + Digest + FixedOutput + Send + Sync,
{
let mut group = c.benchmark_group(format!("STM/{}", hashing_alg));
let mut group = c.benchmark_group(format!("STM/{hashing_alg}"));
let mut rng = ChaCha20Rng::from_seed([0u8; 32]);

let param_string = format!(
Expand All @@ -91,7 +91,7 @@ fn batch_benches<H>(
);

for &nr_batches in array_batches {
let batch_string = format!("{}/batch size: {}", param_string, nr_batches);
let batch_string = format!("{param_string}/batch size: {nr_batches}");

let mut batch_msgs = Vec::with_capacity(nr_batches);
let mut batch_params = Vec::with_capacity(nr_batches);
Expand Down
4 changes: 2 additions & 2 deletions mithril-stm/examples/key_registration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ fn main() {
let msig_1 = match clerk.aggregate(&complete_sigs_1, &msg) {
Ok(s) => s,
Err(e) => {
panic!("Aggregation failed: {:?}", e)
panic!("Aggregation failed: {e:?}")
}
};
assert!(msig_1.verify(&msg, &clerk.compute_avk(), &params).is_ok());

let msig_2 = match clerk.aggregate(&complete_sigs_2, &msg) {
Ok(s) => s,
Err(e) => {
panic!("Aggregation failed: {:?}", e)
panic!("Aggregation failed: {e:?}")
}
};
assert!(msig_2.verify(&msg, &clerk.compute_avk(), &params).is_ok());
Expand Down
6 changes: 3 additions & 3 deletions mithril-stm/src/stm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1015,10 +1015,10 @@ mod tests {
}

let dedup_result = clerk.dedup_sigs_for_indices(&msg, &sigs);
assert!(dedup_result.is_ok(), "dedup failure {:?}", dedup_result);
assert!(dedup_result.is_ok(), "dedup failure {dedup_result:?}");
for passed_sigs in dedup_result.unwrap() {
let verify_result = passed_sigs.verify(&params, &ps[0].vk, &ps[0].stake, &avk, &msg);
assert!(verify_result.is_ok(), "verify {:?}", verify_result);
assert!(verify_result.is_ok(), "verify {verify_result:?}");
}
}
}
Expand All @@ -1044,7 +1044,7 @@ mod tests {
match msig {
Ok(aggr) => {
let verify_result = aggr.verify(&msg, &clerk.compute_avk(), &params);
assert!(verify_result.is_ok(), "Verification failed: {:?}", verify_result);
assert!(verify_result.is_ok(), "Verification failed: {verify_result:?}");
}
Err(AggregationError::NotEnoughSignatures(n, k)) =>
assert!(n < params.k || k == params.k),
Expand Down

0 comments on commit f8a89a8

Please sign in to comment.