From 61bbbab33d879fe2fa9d77a98ec6e71a5222c60d Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Wed, 13 Feb 2019 09:26:29 +1100 Subject: [PATCH] Fix clippy lints in lmd_ghost --- beacon_node/beacon_chain/src/lmd_ghost.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/beacon_node/beacon_chain/src/lmd_ghost.rs b/beacon_node/beacon_chain/src/lmd_ghost.rs index 2c6fbe95a..badd89267 100644 --- a/beacon_node/beacon_chain/src/lmd_ghost.rs +++ b/beacon_node/beacon_chain/src/lmd_ghost.rs @@ -57,16 +57,16 @@ where let start = self .block_store .get_reader(&start_hash)? - .ok_or(Error::MissingBeaconBlock(*start_hash))?; + .ok_or_else(|| Error::MissingBeaconBlock(*start_hash))?; let start_state_root = start.state_root(); let state = self .state_store .get_reader(&start_state_root)? - .ok_or(Error::MissingBeaconState(start_state_root))? + .ok_or_else(|| Error::MissingBeaconState(start_state_root))? .into_beacon_state() - .ok_or(Error::InvalidBeaconState(start_state_root))?; + .ok_or_else(|| Error::InvalidBeaconState(start_state_root))?; let active_validator_indices = get_active_validator_indices( &state.validator_registry, @@ -90,7 +90,7 @@ where &self.block_graph.leaves(), )?; - if child_hashes_and_slots.len() == 0 { + if child_hashes_and_slots.is_empty() { break; } @@ -126,7 +126,7 @@ fn get_vote_count( for target in attestation_targets { let (root_at_slot, _) = block_store .block_at_slot(&block_root, slot)? - .ok_or(Error::MissingBeaconBlock(*block_root))?; + .ok_or_else(|| Error::MissingBeaconBlock(*block_root))?; if root_at_slot == *target { count += 1; } @@ -165,7 +165,7 @@ fn get_child_hashes_and_slots( break; } - current_hash = parent_root.clone(); + current_hash = parent_root; } else { return Err(Error::MissingBeaconBlock(current_hash)); }