From 44f335f111d4f285e4d2d6e211c7616b7efc0aa5 Mon Sep 17 00:00:00 2001 From: Daniel Freire Date: Thu, 23 May 2024 12:50:42 -0300 Subject: [PATCH] lint --- src/bin/relayer.rs | 2 +- src/eth/primitives/transaction_mined.rs | 2 +- src/eth/transaction_relayer.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bin/relayer.rs b/src/bin/relayer.rs index b60433c47..a777f7d79 100644 --- a/src/bin/relayer.rs +++ b/src/bin/relayer.rs @@ -4,7 +4,7 @@ use stratus::config::ExternalRelayerConfig; use stratus::GlobalServices; fn main() -> anyhow::Result<()> { - let global_services = GlobalServices::::init(); + let global_services = GlobalServices::::init()?; global_services.runtime.block_on(run(global_services.config)) } diff --git a/src/eth/primitives/transaction_mined.rs b/src/eth/primitives/transaction_mined.rs index fcaa45d55..0354e7612 100644 --- a/src/eth/primitives/transaction_mined.rs +++ b/src/eth/primitives/transaction_mined.rs @@ -48,7 +48,7 @@ pub struct TransactionMined { impl HashTrait for TransactionMined { fn hash(&self, state: &mut H) { - self.input.hash.hash(state) + self.input.hash.hash(state); } } diff --git a/src/eth/transaction_relayer.rs b/src/eth/transaction_relayer.rs index 5277e2423..2f063071e 100644 --- a/src/eth/transaction_relayer.rs +++ b/src/eth/transaction_relayer.rs @@ -197,7 +197,7 @@ impl ExternalRelayer { for (i, (tx1, set1)) in slot_conflicts.iter().sorted_by_key(|(idx, _)| **idx).enumerate() { for (tx2, set2) in slot_conflicts.iter().sorted_by_key(|(idx, _)| **idx).skip(i + 1) { if !set1.is_disjoint(set2) { - dag.add_edge(*node_indexes.get(&tx1).unwrap(), *node_indexes.get(&tx2).unwrap(), 1).unwrap(); + dag.add_edge(*node_indexes.get(tx1).unwrap(), *node_indexes.get(tx2).unwrap(), 1).unwrap(); // todo: unwrap -> expect } } @@ -206,7 +206,7 @@ impl ExternalRelayer { for (i, (tx1, set1)) in balance_conflicts.iter().sorted_by_key(|(idx, _)| **idx).enumerate() { for (tx2, set2) in balance_conflicts.iter().sorted_by_key(|(idx, _)| **idx).skip(i + 1) { if !set1.is_disjoint(set2) { - dag.add_edge(*node_indexes.get(&tx1).unwrap(), *node_indexes.get(&tx2).unwrap(), 1).unwrap(); + dag.add_edge(*node_indexes.get(tx1).unwrap(), *node_indexes.get(tx2).unwrap(), 1).unwrap(); // todo: unwrap -> expect } } @@ -266,7 +266,7 @@ impl ExternalRelayer { fn take_roots(dag: &mut StableDag) -> Option> { let mut root_indexes = vec![]; for index in dag.node_identifiers() { - if dag.parents(index).walk_next(&dag).is_none() { + if dag.parents(index).walk_next(dag).is_none() { root_indexes.push(index); } } @@ -435,7 +435,7 @@ mod tests { for (test, expected) in tests.into_iter().zip(expected_results) { let transactions = test .into_iter() - .map(|indexes| indexes.into_iter().map(|idx| SlotIndex::from(idx))) + .map(|indexes| indexes.into_iter().map(SlotIndex::from)) .enumerate() .map(|(i, indexes)| create_tx(indexes.collect(), i as u64)) .collect();