Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
lightsing committed Aug 28, 2024
1 parent a51138e commit 69d13c4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/bin/trace-verifier/commands/run_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,21 @@ impl RunFileCommand {

async fn read_block_trace(path: &PathBuf) -> anyhow::Result<BlockTrace> {
let trace = tokio::fs::read_to_string(&path).await?;
Ok(tokio::task::spawn_blocking(move || deserialize_block_trace(&trace)).await??)
tokio::task::spawn_blocking(move || deserialize_block_trace(&trace)).await?
}

fn deserialize_block_trace(trace: &str) -> anyhow::Result<BlockTrace> {
Ok(
// Try to deserialize `BlockTrace` from JSON. In case of failure, try to
// deserialize `BlockTrace` from a JSON-RPC response that has the actual block
// trace nested in the value of the key "result".
serde_json::from_str::<BlockTrace>(&trace).or_else(|_| {
serde_json::from_str::<BlockTrace>(trace).or_else(|_| {
#[derive(serde::Deserialize, Default, Debug, Clone)]
pub struct BlockTraceJsonRpcResult {
pub result: BlockTrace,
}
Ok::<_, serde_json::Error>(
serde_json::from_str::<BlockTraceJsonRpcResult>(&trace)?.result,
serde_json::from_str::<BlockTraceJsonRpcResult>(trace)?.result,
)
})?,
)
Expand Down

0 comments on commit 69d13c4

Please sign in to comment.