mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-10 04:01:51 +00:00
Clippy clean (#536)
* Change into_iter to iter * Fix clippy 'easy' warnings * Clippy eth2/utils * Add struct NetworkInfo * Clippy for types, utils, and beacon_node/store/src/iters.rs * Cargo fmt * Change foo to my_foo * Remove complex signature * suppress clippy warning for unit_value in benches * Use enumerate instead of iterating over range * Allow trivially_copy_pass_by_ref in serde_utils
This commit is contained in:
@@ -59,8 +59,8 @@ pub enum VerifySignatures {
|
||||
}
|
||||
|
||||
impl VerifySignatures {
|
||||
pub fn is_true(&self) -> bool {
|
||||
*self == VerifySignatures::True
|
||||
pub fn is_true(self) -> bool {
|
||||
self == VerifySignatures::True
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ pub fn is_valid_indexed_attestation<T: EthSpec>(
|
||||
let check_sorted = |list: &[u64]| -> Result<()> {
|
||||
list.windows(2).enumerate().try_for_each(|(i, pair)| {
|
||||
if pair[0] >= pair[1] {
|
||||
return Err(error(Invalid::BadValidatorIndicesOrdering(i)));
|
||||
Err(error(Invalid::BadValidatorIndicesOrdering(i)))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ fn invalid_block_header_state_slot() {
|
||||
let builder = get_builder(&spec);
|
||||
let (mut block, mut state) = builder.build(None, None, &spec);
|
||||
|
||||
state.slot = Slot::new(133713);
|
||||
block.slot = Slot::new(424242);
|
||||
state.slot = Slot::new(133_713);
|
||||
block.slot = Slot::new(424_242);
|
||||
|
||||
let result = per_block_processing(
|
||||
&mut state,
|
||||
|
||||
@@ -130,6 +130,6 @@ fn verify_casper_ffg_vote<'a, T: EthSpec>(
|
||||
);
|
||||
Ok(state.get_previous_crosslink(data.crosslink.shard)?)
|
||||
} else {
|
||||
return Err(error(Invalid::BadTargetEpoch));
|
||||
Err(error(Invalid::BadTargetEpoch))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ impl<T: EthSpec> BlockBuilder<T> {
|
||||
builder.set_parent_root(parent_root);
|
||||
|
||||
// Used as a stream of validator indices for use in slashings, exits, etc.
|
||||
let mut validators_iter = (0..keypairs.len() as u64).into_iter();
|
||||
let mut validators_iter = 0..keypairs.len() as u64;
|
||||
|
||||
// Insert `ProposerSlashing` objects.
|
||||
for _ in 0..self.num_proposer_slashings {
|
||||
@@ -171,7 +171,7 @@ impl<T: EthSpec> BlockBuilder<T> {
|
||||
info!("Inserted {} transfers.", builder.block.body.transfers.len());
|
||||
|
||||
// Set the eth1 data to be different from the state.
|
||||
self.block_builder.block.body.eth1_data.block_hash = Hash256::from_slice(&vec![42; 32]);
|
||||
self.block_builder.block.body.eth1_data.block_hash = Hash256::from_slice(&[42; 32]);
|
||||
|
||||
let block = self
|
||||
.block_builder
|
||||
|
||||
Reference in New Issue
Block a user