From c7a5db3c24d781591a462bc59ef384f557449c90 Mon Sep 17 00:00:00 2001 From: teor Date: Tue, 26 Oct 2021 05:34:34 +1000 Subject: [PATCH] Fix or disable the new clippy::question_mark lint (#2946) Co-authored-by: Conrado Gouvea --- zebra-consensus/src/block/check.rs | 8 +++----- zebrad/src/components/sync/status/tests.rs | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/zebra-consensus/src/block/check.rs b/zebra-consensus/src/block/check.rs index 71d4de2e0..9f8f1bd80 100644 --- a/zebra-consensus/src/block/check.rs +++ b/zebra-consensus/src/block/check.rs @@ -189,12 +189,10 @@ pub fn merkle_root_validity( block: &Block, transaction_hashes: &[transaction::Hash], ) -> Result<(), BlockError> { - if block + // TODO: deduplicate zebra-chain and zebra-consensus errors (#2908) + block .check_transaction_network_upgrade_consistency(network) - .is_err() - { - return Err(BlockError::WrongTransactionConsensusBranchId); - } + .map_err(|_| BlockError::WrongTransactionConsensusBranchId)?; let merkle_root = transaction_hashes.iter().cloned().collect(); diff --git a/zebrad/src/components/sync/status/tests.rs b/zebrad/src/components/sync/status/tests.rs index 978043ea9..0e5e8ebfc 100644 --- a/zebrad/src/components/sync/status/tests.rs +++ b/zebrad/src/components/sync/status/tests.rs @@ -129,6 +129,8 @@ proptest! { loop { update_events.acquire().await.forget(); + // The refactor suggested by clippy is harder to read and understand. + #[allow(clippy::question_mark)] if status.wait_until_close_to_tip().await.is_err() { return Ok(()); }