From f3ce5fa5e8b4c34d7e1c705c7c712129e3901d2b Mon Sep 17 00:00:00 2001 From: Brooks Prumo Date: Mon, 23 Aug 2021 08:56:03 -0500 Subject: [PATCH] clippy: branches-sharing-code ```text error: all if blocks contain the same code at the end --> ledger/src/blockstore.rs:3473:5 | 3473 | / Ok(insert_map.get(&slot).unwrap().clone()) 3474 | | } | |_____^ | = note: `-D clippy::branches-sharing-code` implied by `-D warnings` = note: The end suggestion probably needs some adjustments to use the expression result correctly = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#branches_sharing_code help: consider moving the end statements out like this | 3473 ~ } 3474 + Ok(insert_map.get(&slot).unwrap().clone()) | error: could not compile `solana-ledger` due to previous error ``` --- ledger/src/blockstore.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ledger/src/blockstore.rs b/ledger/src/blockstore.rs index 408b24f146..a52249cbd1 100644 --- a/ledger/src/blockstore.rs +++ b/ledger/src/blockstore.rs @@ -3464,14 +3464,13 @@ fn find_slot_meta_in_db_else_create( ) -> Result>> { if let Some(slot_meta) = db.column::().get(slot)? { insert_map.insert(slot, Rc::new(RefCell::new(slot_meta))); - Ok(insert_map.get(&slot).unwrap().clone()) } else { // If this slot doesn't exist, make a orphan slot. This way we // remember which slots chained to this one when we eventually get a real shred // for this slot insert_map.insert(slot, Rc::new(RefCell::new(SlotMeta::new_orphan(slot)))); - Ok(insert_map.get(&slot).unwrap().clone()) } + Ok(insert_map.get(&slot).unwrap().clone()) } // Find the slot metadata in the cache of dirty slot metadata we've previously touched