Skip to content

Commit 3034222

Browse files
committed
Fixed 'protocol-demo' clippy warnings from Rust 1.67.0
1 parent df6024f commit 3034222

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

demo/protocol-demo/src/demonstrator.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ pub struct Party {
6363
impl Party {
6464
/// Party factory
6565
pub fn new(party_id: usize, stake: u64) -> Self {
66-
println!("Party #{}: party created with {} stakes", party_id, stake);
66+
println!("Party #{party_id}: party created with {stake} stakes");
6767
Self {
68-
party_id: format!("{}", party_id) as ProtocolPartyId,
68+
party_id: format!("{party_id}") as ProtocolPartyId,
6969
stake: stake as ProtocolStake,
7070
params: None,
7171
initializer: None,
@@ -225,7 +225,7 @@ impl Verifier {
225225

226226
/// Update protocol parameters
227227
pub fn update_params(&mut self, params: &ProtocolParameters) {
228-
println!("Verifier: protocol params updated to {:?}", params);
228+
println!("Verifier: protocol params updated to {params:?}");
229229
self.params = Some(*params);
230230
}
231231

@@ -242,7 +242,7 @@ impl Verifier {
242242
.iter()
243243
.map(|(party_id, stake, _verification_key)| (party_id.to_owned(), *stake))
244244
.collect::<Vec<_>>();
245-
println!("Verifier: protocol keys registration from {:?}", players);
245+
println!("Verifier: protocol keys registration from {players:?}");
246246

247247
let mut key_reg = ProtocolKeyRegistrationNotCertified::init();
248248
for (_party_id, stake, verification_key) in players_with_keys {
@@ -404,7 +404,7 @@ impl ProtocolDemonstrator for Demonstrator {
404404
let mut multi_signature_artifacts = Vec::new();
405405
for (i, message) in self.messages.iter().enumerate() {
406406
// Issue certificates
407-
println!("Message #{} to sign: {:?}", i, message);
407+
println!("Message #{i} to sign: {message:?}");
408408
let mut signatures = Vec::<ProtocolSingleSignature>::new();
409409
for party in self.parties.iter_mut() {
410410
if let Some(party_signature) = party.sign_message(message) {
@@ -465,7 +465,7 @@ impl ProtocolDemonstrator for Demonstrator {
465465

466466
/// Write artifacts helper
467467
pub fn write_artifacts<T: Serialize>(artifact_name: &str, value: &T) {
468-
let artifacts_file_path_name = format!("artifacts/{}.json", artifact_name);
468+
let artifacts_file_path_name = format!("artifacts/{artifact_name}.json");
469469
let artifacts_file_path = env::current_dir()
470470
.unwrap()
471471
.join(path::Path::new(&artifacts_file_path_name));
@@ -477,7 +477,7 @@ pub fn write_artifacts<T: Serialize>(artifact_name: &str, value: &T) {
477477
serde_json::to_string_pretty(value).unwrap()
478478
)
479479
.unwrap();
480-
println!("Artifacts written to {}", artifacts_file_path_name);
480+
println!("Artifacts written to {artifacts_file_path_name}");
481481
}
482482

483483
#[cfg(test)]

demo/protocol-demo/src/main.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ pub struct Config {
3333
fn main() {
3434
let config = Config::parse();
3535

36-
println!(
37-
">> Launch Mithril protocol demonstrator with configuration: \n{:#?}",
38-
config
39-
);
36+
println!(">> Launch Mithril protocol demonstrator with configuration: \n{config:#?}");
4037

4138
//////////////////////
4239
// establish phase //
@@ -68,7 +65,7 @@ fn main() {
6865
println!("\n>> Congrats, protocol terminated with success!\n")
6966
}
7067
Err(err) => {
71-
println!("\n>> Certificate verification failed: {}\n", err)
68+
println!("\n>> Certificate verification failed: {err}\n")
7269
}
7370
}
7471
}

0 commit comments

Comments
 (0)