From 8fb0e11674d7a81877eda2009fc4adffb9aa63b0 Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Thu, 10 Sep 2020 10:52:51 -0700 Subject: [PATCH] fix: clippy-redundant closures, fmt --- zebra-consensus/src/checkpoint/tests.rs | 5 +++-- zebra-state/src/service.rs | 13 +++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/zebra-consensus/src/checkpoint/tests.rs b/zebra-consensus/src/checkpoint/tests.rs index 72add2fc..0feb7711 100644 --- a/zebra-consensus/src/checkpoint/tests.rs +++ b/zebra-consensus/src/checkpoint/tests.rs @@ -265,8 +265,9 @@ async fn continuous_blockchain(restart_height: Option) -> Result< /// SPANDOC: Verify blocks, restarting at {?restart_height} { - let initial_tip = restart_height - .map(|block::Height(height)| (blockchain[height as usize].1, blockchain[height as usize].2)); + let initial_tip = restart_height.map(|block::Height(height)| { + (blockchain[height as usize].1, blockchain[height as usize].2) + }); let state_service = zebra_state::init(zebra_state::Config::ephemeral(), Mainnet); let mut checkpoint_verifier = CheckpointVerifier::from_list(checkpoint_list, initial_tip, state_service.clone()) diff --git a/zebra-state/src/service.rs b/zebra-state/src/service.rs index 43d50bad..12260128 100644 --- a/zebra-state/src/service.rs +++ b/zebra-state/src/service.rs @@ -62,26 +62,23 @@ impl Service for StateService { rsp_rx .await .expect("sender oneshot is not dropped") - .map(|hash| Response::Committed(hash)) + .map(Response::Committed) } .boxed() } Request::Depth(hash) => { // todo: handle in memory and sled - self.sled - .depth(hash) - .map_ok(|depth| Response::Depth(depth)) - .boxed() + self.sled.depth(hash).map_ok(Response::Depth).boxed() } Request::Tip => { // todo: handle in memory and sled - self.sled.tip().map_ok(|tip| Response::Tip(tip)).boxed() + self.sled.tip().map_ok(Response::Tip).boxed() } Request::BlockLocator => { // todo: handle in memory and sled self.sled .block_locator() - .map_ok(|locator| Response::BlockLocator(locator)) + .map_ok(Response::BlockLocator) .boxed() } Request::Transaction(_) => unimplemented!(), @@ -89,7 +86,7 @@ impl Service for StateService { //todo: handle in memory and sled self.sled .block(hash_or_height) - .map_ok(|block| Response::Block(block)) + .map_ok(Response::Block) .boxed() } }