Skip to content

Commit 513e09c

Browse files
authored
Merge pull request #714 from input-output-hk/jpraynaud/fix-clippy-warnings-rust-1.67.0
Fix clippy warnings from Rust `1.67.0`
2 parents 909e141 + 35eadff commit 513e09c

File tree

70 files changed

+262
-343
lines changed

Some content is hidden

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

70 files changed

+262
-343
lines changed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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
}

mithril-aggregator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-aggregator"
3-
version = "0.2.8"
3+
version = "0.2.9"
44
description = "A Mithril Aggregator server"
55
authors = { workspace = true }
66
edition = { workspace = true }

mithril-aggregator/src/command_args.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,10 @@ impl ServeCommand {
309309
config_builder = config_builder.add_source(self.clone());
310310
let config: Configuration = config_builder
311311
.build()
312-
.map_err(|e| format!("configuration build error: {}", e))?
312+
.map_err(|e| format!("configuration build error: {e}"))?
313313
.try_deserialize()
314-
.map_err(|e| format!("configuration deserialize error: {}", e))?;
315-
debug!("SERVE command"; "config" => format!("{:?}", config));
314+
.map_err(|e| format!("configuration deserialize error: {e}"))?;
315+
debug!("SERVE command"; "config" => format!("{config:?}"));
316316
let sqlite_db_path = Some(config.get_sqlite_file());
317317
check_database_migration(config.get_sqlite_file())?;
318318

@@ -542,10 +542,10 @@ impl ExportGenesisSubCommand {
542542
) -> Result<(), Box<dyn Error>> {
543543
let config: GenesisConfiguration = config_builder
544544
.build()
545-
.map_err(|e| format!("configuration build error: {}", e))?
545+
.map_err(|e| format!("configuration build error: {e}"))?
546546
.try_deserialize()
547-
.map_err(|e| format!("configuration deserialize error: {}", e))?;
548-
debug!("EXPORT GENESIS command"; "config" => format!("{:?}", config));
547+
.map_err(|e| format!("configuration deserialize error: {e}"))?;
548+
debug!("EXPORT GENESIS command"; "config" => format!("{config:?}"));
549549
println!(
550550
"Genesis export payload to sign to {}",
551551
self.target_path.display()
@@ -571,10 +571,10 @@ impl ImportGenesisSubCommand {
571571
) -> Result<(), Box<dyn Error>> {
572572
let config: GenesisConfiguration = config_builder
573573
.build()
574-
.map_err(|e| format!("configuration build error: {}", e))?
574+
.map_err(|e| format!("configuration build error: {e}"))?
575575
.try_deserialize()
576-
.map_err(|e| format!("configuration deserialize error: {}", e))?;
577-
debug!("IMPORT GENESIS command"; "config" => format!("{:?}", config));
576+
.map_err(|e| format!("configuration deserialize error: {e}"))?;
577+
debug!("IMPORT GENESIS command"; "config" => format!("{config:?}"));
578578
println!(
579579
"Genesis import signed payload from {}",
580580
self.signed_payload_path.to_string_lossy()
@@ -602,10 +602,10 @@ impl BootstrapGenesisSubCommand {
602602
) -> Result<(), Box<dyn Error>> {
603603
let config: GenesisConfiguration = config_builder
604604
.build()
605-
.map_err(|e| format!("configuration build error: {}", e))?
605+
.map_err(|e| format!("configuration build error: {e}"))?
606606
.try_deserialize()
607-
.map_err(|e| format!("configuration deserialize error: {}", e))?;
608-
debug!("BOOTSTRAP GENESIS command"; "config" => format!("{:?}", config));
607+
.map_err(|e| format!("configuration deserialize error: {e}"))?;
608+
debug!("BOOTSTRAP GENESIS command"; "config" => format!("{config:?}"));
609609
println!("Genesis bootstrap for test only!");
610610
let dependencies = setup_genesis_dependencies(&config)?;
611611

mithril-aggregator/src/http_server/routes/certificate_routes.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ mod tests {
121121

122122
let response = request()
123123
.method(method)
124-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
124+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
125125
.reply(&setup_router(Arc::new(dependency_manager)))
126126
.await;
127127

@@ -143,7 +143,7 @@ mod tests {
143143

144144
let response = request()
145145
.method(method)
146-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
146+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
147147
.reply(&setup_router(Arc::new(dependency_manager)))
148148
.await;
149149

@@ -164,7 +164,7 @@ mod tests {
164164

165165
let response = request()
166166
.method(method)
167-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
167+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
168168
.reply(&setup_router(Arc::new(dependency_manager)))
169169
.await;
170170

@@ -191,7 +191,7 @@ mod tests {
191191

192192
let response = request()
193193
.method(method)
194-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
194+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
195195
.reply(&setup_router(Arc::new(dependency_manager)))
196196
.await;
197197

@@ -213,7 +213,7 @@ mod tests {
213213

214214
let response = request()
215215
.method(method)
216-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
216+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
217217
.reply(&setup_router(Arc::new(dependency_manager)))
218218
.await;
219219

@@ -240,7 +240,7 @@ mod tests {
240240

241241
let response = request()
242242
.method(method)
243-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
243+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
244244
.reply(&setup_router(Arc::new(dependency_manager)))
245245
.await;
246246

mithril-aggregator/src/http_server/routes/epoch_routes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ mod handlers {
5555
protocol_parameters,
5656
next_protocol_parameters,
5757
};
58-
println!("EpochSettings={:?}", epoch_settings);
58+
println!("EpochSettings={epoch_settings:?}");
5959
let epoch_settings_message =
6060
ToEpochSettingsMessageAdapter::adapt(epoch_settings);
6161
Ok(reply::json(&epoch_settings_message, StatusCode::OK))
@@ -116,7 +116,7 @@ mod tests {
116116

117117
let response = request()
118118
.method(method)
119-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
119+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
120120
.reply(&setup_router(Arc::new(dependency_manager)))
121121
.await;
122122

@@ -137,7 +137,7 @@ mod tests {
137137

138138
let response = request()
139139
.method(method)
140-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
140+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
141141
.reply(&setup_router(Arc::new(dependency_manager)))
142142
.await;
143143

mithril-aggregator/src/http_server/routes/signatures_routes.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ mod tests {
101101

102102
let response = request()
103103
.method(method)
104-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
104+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
105105
.json(&message)
106106
.reply(&setup_router(Arc::new(dependency_manager)))
107107
.await;
@@ -132,7 +132,7 @@ mod tests {
132132

133133
let response = request()
134134
.method(method)
135-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
135+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
136136
.json(&message)
137137
.reply(&setup_router(Arc::new(dependency_manager)))
138138
.await;
@@ -165,7 +165,7 @@ mod tests {
165165

166166
let response = request()
167167
.method(method)
168-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
168+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
169169
.json(&message)
170170
.reply(&setup_router(Arc::new(dependency_manager)))
171171
.await;
@@ -198,7 +198,7 @@ mod tests {
198198

199199
let response = request()
200200
.method(method)
201-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
201+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
202202
.json(&message)
203203
.reply(&setup_router(Arc::new(dependency_manager)))
204204
.await;

mithril-aggregator/src/http_server/routes/signer_routes.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ mod tests {
112112

113113
let response = request()
114114
.method(method)
115-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
115+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
116116
.json(&signer)
117117
.reply(&setup_router(Arc::new(dependency_manager)))
118118
.await;
@@ -142,7 +142,7 @@ mod tests {
142142

143143
let response = request()
144144
.method(method)
145-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
145+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
146146
.json(&signer)
147147
.reply(&setup_router(Arc::new(dependency_manager)))
148148
.await;
@@ -176,7 +176,7 @@ mod tests {
176176

177177
let response = request()
178178
.method(method)
179-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
179+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
180180
.json(&signer)
181181
.reply(&setup_router(Arc::new(dependency_manager)))
182182
.await;
@@ -209,7 +209,7 @@ mod tests {
209209

210210
let response = request()
211211
.method(method)
212-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
212+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
213213
.json(&signer)
214214
.reply(&setup_router(Arc::new(dependency_manager)))
215215
.await;

0 commit comments

Comments
 (0)