Skip to content

Commit 585f1f9

Browse files
committed
Fixed 'mithril-signer' clippy warnings from Rust 1.67.0
1 parent 215161c commit 585f1f9

File tree

6 files changed

+16
-29
lines changed

6 files changed

+16
-29
lines changed

mithril-signer/src/certificate_handler.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ impl CertificateHandlerHTTPClient {
107107
))
108108
} else {
109109
CertificateHandlerError::ApiVersionMismatch(format!(
110-
"version precondition failed, sent version '{}'.",
111-
MITHRIL_API_VERSION
110+
"version precondition failed, sent version '{MITHRIL_API_VERSION}'."
112111
))
113112
}
114113
}

mithril-signer/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,17 @@ async fn main() -> Result<(), Box<dyn Error>> {
9191
)
9292
.add_source(config::Environment::default())
9393
.build()
94-
.map_err(|e| format!("configuration build error: {}", e))?
94+
.map_err(|e| format!("configuration build error: {e}"))?
9595
.try_deserialize()
96-
.map_err(|e| format!("configuration deserialize error: {}", e))?;
96+
.map_err(|e| format!("configuration deserialize error: {e}"))?;
9797
let services = ProductionServiceBuilder::new(&config).build().await?;
9898
DatabaseVersionChecker::new(
9999
slog_scope::logger(),
100100
ApplicationNodeType::Signer,
101101
config.get_sqlite_file(),
102102
)
103103
.apply()?;
104-
debug!("Started"; "run_mode" => &args.run_mode, "config" => format!("{:?}", config));
104+
debug!("Started"; "run_mode" => &args.run_mode, "config" => format!("{config:?}"));
105105

106106
let mut state_machine = StateMachine::new(
107107
SignerState::Unregistered(None),

mithril-signer/src/runtime/runner.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@ impl Runner for SignerRunner {
173173
.await?
174174
.ok_or_else(|| {
175175
RuntimeError::NoValueError(format!(
176-
"stakes at epoch {}",
177-
epoch_offset_to_recording_epoch
176+
"stakes at epoch {epoch_offset_to_recording_epoch}"
178177
))
179178
})?;
180179
let stake = stake_distribution
@@ -314,7 +313,7 @@ impl Runner for SignerRunner {
314313
.stake_store
315314
.get_stakes(epoch)
316315
.await?
317-
.ok_or_else(|| RuntimeError::NoValueError(format!("stakes at epoch {}", epoch)))?;
316+
.ok_or_else(|| RuntimeError::NoValueError(format!("stakes at epoch {epoch}")))?;
318317
let mut signers_with_stake = vec![];
319318

320319
for signer in signers {
@@ -361,8 +360,7 @@ impl Runner for SignerRunner {
361360
.await?
362361
.ok_or_else(|| {
363362
RuntimeError::NoValueError(format!(
364-
"protocol_initializer at epoch {}",
365-
next_signer_retrieval_epoch
363+
"protocol_initializer at epoch {next_signer_retrieval_epoch}"
366364
))
367365
})?;
368366

@@ -392,8 +390,7 @@ impl Runner for SignerRunner {
392390
.await?
393391
.ok_or_else(|| {
394392
RuntimeError::NoValueError(format!(
395-
"protocol_initializer at epoch {}",
396-
signer_retrieval_epoch
393+
"protocol_initializer at epoch {signer_retrieval_epoch}"
397394
))
398395
})?;
399396
let signature = self.services.single_signer.compute_single_signatures(

mithril-signer/src/runtime/signer_services.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,9 @@ impl<'a> ProductionServiceBuilder<'a> {
5454
match &self.config.operational_certificate_path {
5555
Some(operational_certificate_path) => {
5656
let opcert: OpCert = OpCert::from_file(operational_certificate_path)
57-
.map_err(|e| format!("Could not decode operational certificate: {:?}", e))?;
57+
.map_err(|e| format!("Could not decode operational certificate: {e:?}"))?;
5858
Ok(opcert.compute_protocol_party_id().map_err(|e| {
59-
format!(
60-
"Could not compute party_id from operational certificate: {:?}",
61-
e
62-
)
59+
format!("Could not compute party_id from operational certificate: {e:?}")
6360
})?)
6461
}
6562
_ => Ok(self
@@ -95,7 +92,7 @@ impl<'a> ServiceBuilder for ProductionServiceBuilder<'a> {
9592
async fn build(&self) -> Result<SignerServices, Box<dyn StdError>> {
9693
if !self.config.data_stores_directory.exists() {
9794
fs::create_dir_all(self.config.data_stores_directory.clone())
98-
.map_err(|e| format!("Could not create data stores directory: {:?}", e))?;
95+
.map_err(|e| format!("Could not create data stores directory: {e:?}"))?;
9996
}
10097

10198
let sqlite_db_path = Some(self.config.get_sqlite_file());
@@ -181,10 +178,10 @@ mod tests {
181178

182179
if test_dir.exists() {
183180
fs::remove_dir_all(&test_dir)
184-
.unwrap_or_else(|_| panic!("Could not remove dir {:?}", test_dir));
181+
.unwrap_or_else(|_| panic!("Could not remove dir {test_dir:?}"));
185182
}
186183
fs::create_dir_all(&test_dir)
187-
.unwrap_or_else(|_| panic!("Could not create dir {:?}", test_dir));
184+
.unwrap_or_else(|_| panic!("Could not create dir {test_dir:?}"));
188185

189186
test_dir
190187
}

mithril-signer/src/runtime/state_machine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl Display for SignerState {
5656
"Unregistered - {}",
5757
match state {
5858
None => "No Epoch".to_string(),
59-
Some(e) => format!("Epoch({})", e),
59+
Some(e) => format!("Epoch({e})"),
6060
}
6161
),
6262
Self::Registered(state) => write!(f, "Registered - {}", state.beacon),

mithril-signer/tests/test_extensions/state_machine_tester.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,7 @@ impl StateMachineTester {
240240
let new_immutable = immutable_number + increment;
241241
self.assert(
242242
expected == new_immutable,
243-
format!(
244-
"expected to increase immutable number up to {}, got {}",
245-
expected, new_immutable
246-
),
243+
format!("expected to increase immutable number up to {expected}, got {new_immutable}"),
247244
)?;
248245
self.immutable_observer
249246
.shall_return(Some(new_immutable))
@@ -262,10 +259,7 @@ impl StateMachineTester {
262259

263260
self.assert(
264261
expected == new_epoch,
265-
format!(
266-
"Epoch increased by 1 to {} ({} expected)",
267-
new_epoch, expected
268-
),
262+
format!("Epoch increased by 1 to {new_epoch} ({expected} expected)"),
269263
)
270264
}
271265

0 commit comments

Comments
 (0)