Skip to content

Commit d49c96a

Browse files
committed
chore(rust): clippy lint fix
1 parent 92689bf commit d49c96a

File tree

7 files changed

+13
-17
lines changed

7 files changed

+13
-17
lines changed

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

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

369369
// Convert the timestamp to a DateTime and handle any potential errors
370370
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
@@ -100,7 +100,7 @@ impl TryFrom<u64> for ScriptType {
100100

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

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
@@ -397,7 +397,7 @@ impl FileDownloader for MithrilTurboDownloader {
397397

398398
// We only support full downloads for now.
399399
if !matches!(download_event_type, DownloadEvent::Full { .. }) {
400-
bail!("Unsupported Download Event Type: {:?}", download_event_type);
400+
bail!("Unsupported Download Event Type: {download_event_type:?}");
401401
}
402402

403403
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
@@ -417,10 +417,7 @@ impl ParallelDownloadProcessor {
417417
chain: Network,
418418
) -> Result<Self> {
419419
if cfg.chunk_size < MIN_CHUNK_SIZE {
420-
bail!(
421-
"Download chunk size must be at least {} bytes",
422-
MIN_CHUNK_SIZE
423-
);
420+
bail!("Download chunk size must be at least {MIN_CHUNK_SIZE} bytes");
424421
}
425422
let file_size = get_content_length_async(url).await?;
426423

@@ -595,7 +592,7 @@ impl ParallelDownloadProcessor {
595592
let queue = worker_queue.value();
596593
queue.send(order)?;
597594
} else {
598-
bail!("Expected a work queue for worker: {:?}", this_worker);
595+
bail!("Expected a work queue for worker: {this_worker:?}");
599596
}
600597
} else {
601598
// No more work, so remove the work queue from the map.
@@ -779,7 +776,7 @@ async fn get_content_length_async(url: &str) -> Result<usize> {
779776
Ok(result) => result,
780777
Err(error) => {
781778
error!("get_content_length failed");
782-
Err(anyhow::anyhow!("get_content_length failed: {}", error))
779+
Err(anyhow::anyhow!("get_content_length failed: {error}"))
783780
},
784781
}
785782
}
@@ -799,8 +796,7 @@ fn get_content_length(url: &str) -> Result<usize> {
799796
if let Some(accept_ranges) = response.header(ACCEPT_RANGES.as_str()) {
800797
if accept_ranges != "bytes" {
801798
bail!(
802-
"Server doesn't support HTTP range byte requests (Accept-Ranges = {})",
803-
accept_ranges
799+
"Server doesn't support HTTP range byte requests (Accept-Ranges = {accept_ranges})"
804800
);
805801
}
806802
} else {

rust/signed_doc/src/metadata/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl Metadata {
190190
let fields = serde::Deserializer::deserialize_map(fields, MetadataDeserializeVisitor)?;
191191
let report = ProblemReport::new("Deserializing metadata from json");
192192
let metadata = Self::from_fields(fields.into_iter().map(anyhow::Result::<_>::Ok), &report)?;
193-
anyhow::ensure!(!report.is_problematic(), "{:?}", report);
193+
anyhow::ensure!(!report.is_problematic(), "{report:?}");
194194
Ok(metadata)
195195
}
196196

rust/signed_doc/src/validator/rules/content_type.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl ContentTypeRule {
106106
ContentType::Json => {
107107
if let Err(e) = serde_json::from_slice::<&serde_json::value::RawValue>(content)
108108
{
109-
anyhow::bail!("Invalid {} content: {e}", exp)
109+
anyhow::bail!("Invalid {exp} content: {e}")
110110
}
111111
},
112112
ContentType::Cbor => {
@@ -129,7 +129,7 @@ impl ContentTypeRule {
129129
| ContentType::Plain
130130
| ContentType::PlainHandlebars => {
131131
// TODO: not implemented yet
132-
anyhow::bail!("`{}` is valid but unavailable yet", exp)
132+
anyhow::bail!("`{exp}` is valid but unavailable yet")
133133
},
134134
}
135135
}

0 commit comments

Comments
 (0)