Skip to content

Commit 364cab5

Browse files
committed
Fixed 'mithril-aggregator' clippy warnings from Rust 1.67.0
1 parent 3034222 commit 364cab5

File tree

15 files changed

+68
-90
lines changed

15 files changed

+68
-90
lines changed

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;

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ mod tests {
216216

217217
let response = request()
218218
.method(method)
219-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
219+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
220220
.reply(&setup_router(Arc::new(dependency_manager)))
221221
.await;
222222

@@ -246,7 +246,7 @@ mod tests {
246246

247247
let response = request()
248248
.method(method)
249-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
249+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
250250
.reply(&setup_router(Arc::new(dependency_manager)))
251251
.await;
252252

@@ -275,7 +275,7 @@ mod tests {
275275

276276
let response = request()
277277
.method(method)
278-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
278+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
279279
.reply(&setup_router(Arc::new(dependency_manager)))
280280
.await;
281281

@@ -304,7 +304,7 @@ mod tests {
304304

305305
let response = request()
306306
.method(method)
307-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
307+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
308308
.reply(&setup_router(Arc::new(dependency_manager)))
309309
.await;
310310

@@ -334,7 +334,7 @@ mod tests {
334334

335335
let response = request()
336336
.method(method)
337-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
337+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
338338
.reply(&setup_router(Arc::new(dependency_manager)))
339339
.await;
340340

@@ -363,7 +363,7 @@ mod tests {
363363

364364
let response = request()
365365
.method(method)
366-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
366+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
367367
.reply(&setup_router(Arc::new(dependency_manager)))
368368
.await;
369369

@@ -391,7 +391,7 @@ mod tests {
391391

392392
let response = request()
393393
.method(method)
394-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
394+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
395395
.reply(&setup_router(Arc::new(dependency_manager)))
396396
.await;
397397

@@ -421,7 +421,7 @@ mod tests {
421421

422422
let response = request()
423423
.method(method)
424-
.path(&format!("/{}{}", SERVER_BASE_PATH, path))
424+
.path(&format!("/{SERVER_BASE_PATH}{path}"))
425425
.reply(&setup_router(Arc::new(dependency_manager)))
426426
.await;
427427

mithril-aggregator/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
2626
let result = args.execute().await;
2727

2828
if result.is_err() {
29-
eprintln!("ERROR: application ends abnormaly: {:?}", result);
29+
eprintln!("ERROR: application ends abnormaly: {result:?}");
3030
}
3131

3232
result

mithril-aggregator/src/snapshot_stores/remote_snapshot_store.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ impl SnapshotStore for RemoteSnapshotStore {
4242
Err(err) => Err(SnapshotStoreError::Manifest(err.to_string())),
4343
},
4444
status_error => Err(SnapshotStoreError::Manifest(format!(
45-
"error {} received",
46-
status_error
45+
"error {status_error} received"
4746
))),
4847
},
4948
Err(err) => Err(SnapshotStoreError::Manifest(err.to_string())),

mithril-aggregator/src/snapshot_uploaders/dumb_snapshot_uploader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl DumbSnapshotUploader {
2424
let value = self
2525
.last_uploaded
2626
.read()
27-
.map_err(|e| format!("Error while saving filepath location: {}", e))?;
27+
.map_err(|e| format!("Error while saving filepath location: {e}"))?;
2828

2929
Ok(value.as_ref().map(|v| v.to_string()))
3030
}
@@ -43,7 +43,7 @@ impl SnapshotUploader for DumbSnapshotUploader {
4343
let mut value = self
4444
.last_uploaded
4545
.write()
46-
.map_err(|e| format!("Error while saving filepath location: {}", e))?;
46+
.map_err(|e| format!("Error while saving filepath location: {e}"))?;
4747

4848
*value = Some(snapshot_filepath.to_string_lossy().to_string());
4949

mithril-aggregator/src/snapshot_uploaders/local_snapshot_uploader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl SnapshotUploader for LocalSnapshotUploader {
3333
let target_path = &self.target_location.join(archive_name);
3434
tokio::fs::copy(snapshot_filepath, target_path)
3535
.await
36-
.map_err(|e| format!("Snapshot copy failure: {}", e))?;
36+
.map_err(|e| format!("Snapshot copy failure: {e}"))?;
3737

3838
let digest = tools::extract_digest_from_path(Path::new(archive_name));
3939
let location = format!(
@@ -58,7 +58,7 @@ mod tests {
5858
use tempfile::tempdir;
5959

6060
fn create_fake_archive(dir: &Path, digest: &str) -> PathBuf {
61-
let file_path = dir.join(format!("test.{}.tar.gz", digest));
61+
let file_path = dir.join(format!("test.{digest}.tar.gz"));
6262
let mut file = File::create(&file_path).unwrap();
6363
writeln!(
6464
file,

0 commit comments

Comments
 (0)