mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
Fix clippy warnings (#813)
* Clippy account manager * Clippy account_manager * Clippy beacon_node/beacon_chain * Clippy beacon_node/client * Clippy beacon_node/eth1 * Clippy beacon_node/eth2-libp2p * Clippy beacon_node/genesis * Clippy beacon_node/network * Clippy beacon_node/rest_api * Clippy beacon_node/src * Clippy beacon_node/store * Clippy eth2/lmd_ghost * Clippy eth2/operation_pool * Clippy eth2/state_processing * Clippy eth2/types * Clippy eth2/utils/bls * Clippy eth2/utils/cahced_tree_hash * Clippy eth2/utils/deposit_contract * Clippy eth2/utils/eth2_interop_keypairs * Clippy eth2/utils/eth2_testnet_config * Clippy eth2/utils/lighthouse_metrics * Clippy eth2/utils/ssz * Clippy eth2/utils/ssz_types * Clippy eth2/utils/tree_hash_derive * Clippy lcli * Clippy tests/beacon_chain_sim * Clippy validator_client * Cargo fmt
This commit is contained in:
@@ -145,7 +145,7 @@ pub fn state_at_slot<T: BeaconChainTypes>(
|
||||
// I'm not sure if this `.clone()` will be optimized out. If not, it seems unnecessary.
|
||||
Ok((
|
||||
beacon_chain.head()?.beacon_state_root,
|
||||
beacon_chain.head()?.beacon_state.clone(),
|
||||
beacon_chain.head()?.beacon_state,
|
||||
))
|
||||
} else {
|
||||
let root = state_root_at_slot(beacon_chain, slot)?;
|
||||
@@ -209,7 +209,7 @@ pub fn state_root_at_slot<T: BeaconChainTypes>(
|
||||
//
|
||||
// Use `per_slot_processing` to advance the head state to the present slot,
|
||||
// assuming that all slots do not contain a block (i.e., they are skipped slots).
|
||||
let mut state = beacon_chain.head()?.beacon_state.clone();
|
||||
let mut state = beacon_chain.head()?.beacon_state;
|
||||
let spec = &T::EthSpec::default_spec();
|
||||
|
||||
for _ in state.slot.as_u64()..slot.as_u64() {
|
||||
|
||||
@@ -54,6 +54,8 @@ pub struct NetworkInfo<T: BeaconChainTypes> {
|
||||
pub network_chan: mpsc::UnboundedSender<NetworkMessage>,
|
||||
}
|
||||
|
||||
// Allowing more than 7 arguments.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn start_server<T: BeaconChainTypes>(
|
||||
config: &Config,
|
||||
executor: &TaskExecutor,
|
||||
|
||||
@@ -19,6 +19,8 @@ where
|
||||
Box::new(item.into_future())
|
||||
}
|
||||
|
||||
// Allowing more than 7 arguments.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn route<T: BeaconChainTypes>(
|
||||
req: Request<Body>,
|
||||
beacon_chain: Arc<BeaconChain<T>>,
|
||||
|
||||
@@ -47,8 +47,7 @@ fn get_randao_reveal<T: BeaconChainTypes>(
|
||||
.head()
|
||||
.expect("should get head")
|
||||
.beacon_state
|
||||
.fork
|
||||
.clone();
|
||||
.fork;
|
||||
let proposer_index = beacon_chain
|
||||
.block_proposer(slot)
|
||||
.expect("should get proposer index");
|
||||
@@ -69,8 +68,7 @@ fn sign_block<T: BeaconChainTypes>(
|
||||
.head()
|
||||
.expect("should get head")
|
||||
.beacon_state
|
||||
.fork
|
||||
.clone();
|
||||
.fork;
|
||||
let proposer_index = beacon_chain
|
||||
.block_proposer(block.slot)
|
||||
.expect("should get proposer index");
|
||||
@@ -91,11 +89,7 @@ fn validator_produce_attestation() {
|
||||
.client
|
||||
.beacon_chain()
|
||||
.expect("client should have beacon chain");
|
||||
let state = beacon_chain
|
||||
.head()
|
||||
.expect("should get head")
|
||||
.beacon_state
|
||||
.clone();
|
||||
let state = beacon_chain.head().expect("should get head").beacon_state;
|
||||
|
||||
let validator_index = 0;
|
||||
let duties = state
|
||||
@@ -169,7 +163,7 @@ fn validator_produce_attestation() {
|
||||
remote_node
|
||||
.http
|
||||
.validator()
|
||||
.publish_attestation(attestation.clone()),
|
||||
.publish_attestation(attestation),
|
||||
)
|
||||
.expect("should publish attestation");
|
||||
assert!(
|
||||
@@ -344,7 +338,7 @@ fn validator_block_post() {
|
||||
remote_node
|
||||
.http
|
||||
.validator()
|
||||
.produce_block(slot, randao_reveal.clone()),
|
||||
.produce_block(slot, randao_reveal),
|
||||
)
|
||||
.expect("should fetch block from http api");
|
||||
|
||||
@@ -360,12 +354,12 @@ fn validator_block_post() {
|
||||
);
|
||||
}
|
||||
|
||||
sign_block(beacon_chain.clone(), &mut block, spec);
|
||||
sign_block(beacon_chain, &mut block, spec);
|
||||
let block_root = block.canonical_root();
|
||||
|
||||
let publish_status = env
|
||||
.runtime()
|
||||
.block_on(remote_node.http.validator().publish_block(block.clone()))
|
||||
.block_on(remote_node.http.validator().publish_block(block))
|
||||
.expect("should publish block");
|
||||
|
||||
if cfg!(not(feature = "fake_crypto")) {
|
||||
@@ -419,7 +413,7 @@ fn validator_block_get() {
|
||||
.expect("client should have beacon chain");
|
||||
|
||||
let slot = Slot::new(1);
|
||||
let randao_reveal = get_randao_reveal(beacon_chain.clone(), slot, spec);
|
||||
let randao_reveal = get_randao_reveal(beacon_chain, slot, spec);
|
||||
|
||||
let block = env
|
||||
.runtime()
|
||||
|
||||
Reference in New Issue
Block a user