Skip to content

Commit dfc0dbe

Browse files
committed
fix clippy
1 parent f3d1a80 commit dfc0dbe

File tree

7 files changed

+12
-19
lines changed

7 files changed

+12
-19
lines changed

rust/c509-certificate/examples/cli/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ fn time_to_string(time: u64) -> anyhow::Result<String> {
347347
// Attempt to convert the timestamp and handle errors if they occur
348348
let timestamp: i64 = time
349349
.try_into()
350-
.map_err(|e| anyhow::anyhow!("Failed to convert time: {:?}", e))?;
350+
.map_err(|e| anyhow::anyhow!("Failed to convert time: {e:?}"))?;
351351

352352
// Convert the timestamp to a DateTime and handle any potential errors
353353
let datetime = DateTime::from_timestamp(timestamp, 0)

rust/cardano-blockchain-types/src/auxdata/scripts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl TryFrom<u64> for ScriptType {
9898

9999
fn try_from(value: u64) -> Result<Self, Self::Error> {
100100
match value {
101-
0 => Err(anyhow!("Invalid script type: {}", value)),
101+
0 => Err(anyhow!("Invalid script type: {value}")),
102102
1 => Ok(Self::Native),
103103
_ => Ok(Self::Plutus(value.saturating_sub(1))),
104104
}

rust/cardano-chain-follower/src/mithril_snapshot_config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ impl MithrilSnapshotConfig {
239239

240240
let Ok(relative_file) = tmp_file.strip_prefix(&tmp_path) else {
241241
error!("Failed to get relative path of file.");
242-
bail!("Failed to strip prefix: {tmp_path:?}");
242+
bail!("Failed to strip prefix: {}", tmp_path.to_string_lossy());
243243
};
244244

245245
// IF we make it here, the files are identical, so we can de-dup them safely.
@@ -251,7 +251,7 @@ impl MithrilSnapshotConfig {
251251
tmp_file.to_string_lossy(),
252252
error
253253
);
254-
bail!("Failed to remove tmp file: {tmp_file:?}");
254+
bail!("Failed to remove tmp file: {}", tmp_file.to_string_lossy());
255255
}
256256
}
257257

@@ -270,7 +270,7 @@ impl MithrilSnapshotConfig {
270270
tmp_file.to_string_lossy(),
271271
error
272272
);
273-
bail!("Failed to link src file: {src_file:?}");
273+
bail!("Failed to link src file: {}", src_file.to_string_lossy());
274274
}
275275

276276
// And if we made it here, file was successfully de-duped. YAY.

rust/cardano-chain-follower/src/mithril_turbo_downloader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ impl FileDownloader for MithrilTurboDownloader {
376376

377377
// We only support full downloads for now.
378378
if !matches!(download_event_type, DownloadEvent::Full { .. }) {
379-
bail!("Unsupported Download Event Type: {:?}", download_event_type);
379+
bail!("Unsupported Download Event Type: {download_event_type:?}");
380380
}
381381

382382
let location = location.as_str();

rust/cardano-chain-follower/src/turbo_downloader/mod.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,7 @@ impl ParallelDownloadProcessor {
375375
/// the content length.
376376
pub(crate) async fn new(url: &str, mut cfg: DlConfig, chain: Network) -> Result<Self> {
377377
if cfg.chunk_size < MIN_CHUNK_SIZE {
378-
bail!(
379-
"Download chunk size must be at least {} bytes",
380-
MIN_CHUNK_SIZE
381-
);
378+
bail!("Download chunk size must be at least {MIN_CHUNK_SIZE} bytes");
382379
}
383380
let file_size = get_content_length_async(url).await?;
384381

@@ -541,7 +538,7 @@ impl ParallelDownloadProcessor {
541538
let queue = worker_queue.value();
542539
queue.send(order)?;
543540
} else {
544-
bail!("Expected a work queue for worker: {:?}", this_worker);
541+
bail!("Expected a work queue for worker: {this_worker:?}");
545542
}
546543
} else {
547544
// No more work, so remove the work queue from the map.
@@ -719,7 +716,7 @@ async fn get_content_length_async(url: &str) -> Result<usize> {
719716
Ok(result) => result,
720717
Err(error) => {
721718
error!("get_content_length failed");
722-
Err(anyhow::anyhow!("get_content_length failed: {}", error))
719+
Err(anyhow::anyhow!("get_content_length failed: {error}"))
723720
},
724721
}
725722
}
@@ -739,8 +736,7 @@ fn get_content_length(url: &str) -> Result<usize> {
739736
if let Some(accept_ranges) = response.header(ACCEPT_RANGES.as_str()) {
740737
if accept_ranges != "bytes" {
741738
bail!(
742-
"Server doesn't support HTTP range byte requests (Accept-Ranges = {})",
743-
accept_ranges
739+
"Server doesn't support HTTP range byte requests (Accept-Ranges = {accept_ranges})"
744740
);
745741
}
746742
} else {

rust/immutable-ledger/src/serialize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ impl BlockHeader {
427427
let prev_block_hash_type = match hash_function.as_u64() {
428428
BLAKE3_CBOR_TAG => HashFunction::Blake3,
429429
BLAKE_2B_CBOR_TAG => HashFunction::Blake2b,
430-
_ => bail!(format!("Invalid hash function type {:?}", hash_function)),
430+
_ => bail!(format!("Invalid hash function type {hash_function:?}")),
431431
};
432432

433433
let prev_block_hash = cbor_decoder

rust/rbac-registration/src/cardano/cip509/utils/cip19.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ pub(crate) fn compare_key_hash(
2020
pk_addrs.iter().try_for_each(|pk_addr| {
2121
// Key hash not found in the transaction witness set
2222
if !witness.check_witness_in_tx(pk_addr, txn_idx) {
23-
bail!(
24-
"Public key hash not found in transaction witness set given {:?}",
25-
pk_addr
26-
);
23+
bail!("Public key hash not found in transaction witness set given {pk_addr:?}");
2724
}
2825

2926
Ok(())

0 commit comments

Comments
 (0)