Skip to content

Commit 0f1cabd

Browse files
committed
Refactor
1 parent a8c6bf7 commit 0f1cabd

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/tool/subcommands/api_cmd/test_snapshot.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,14 @@ fn backfill_eth_mappings(db: &MemoryDB, index: Option<Index>) -> anyhow::Result<
5555
if let Some(mut guard) = db.eth_mappings_db.try_write() {
5656
if let Some(eth_mappings) = index.eth_mappings {
5757
for (k, v) in eth_mappings.iter() {
58-
if let Ok(hash) = EthHash::from_str(k) {
59-
guard.insert(hash, v.0.clone());
60-
}
58+
guard.insert(EthHash::from_str(k)?, v.0.clone());
6159
}
6260
}
6361
}
6462
if let Some(mut guard) = db.indices_db.try_write() {
6563
if let Some(indices) = index.indices {
6664
for (k, v) in indices.iter() {
67-
if let Ok(cid) = Cid::from_str(k) {
68-
guard.insert(cid, v.0.clone());
69-
}
65+
guard.insert(Cid::from_str(k)?, v.0.clone());
7066
}
7167
}
7268
}

0 commit comments

Comments
 (0)