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
```
This commit is contained in:
Brooks Prumo 2021-08-23 08:56:03 -05:00 committed by Brooks Prumo
parent 96360f3139
commit f3ce5fa5e8
1 changed files with 1 additions and 2 deletions

View File

@ -3464,14 +3464,13 @@ fn find_slot_meta_in_db_else_create(
) -> Result<Rc<RefCell<SlotMeta>>> {
if let Some(slot_meta) = db.column::<cf::SlotMeta>().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