Fix Rust 1.61 clippy lints (#3192)

## Issue Addressed

This fixes the low-hanging Clippy lints introduced in Rust 1.61 (due any hour now). It _ignores_ one lint, because fixing it requires a structural refactor of the validator client that needs to be done delicately. I've started on that refactor and will create another PR that can be reviewed in more depth in the coming days. I think we should merge this PR in the meantime to unblock CI.
This commit is contained in:
Michael Sproul
2022-05-20 05:02:13 +00:00
parent aa3e67de4a
commit 6eaeaa542f
9 changed files with 54 additions and 53 deletions

View File

@@ -107,15 +107,16 @@ impl<E: EthSpec> LocalNetwork<E> {
beacon_config.network.discv5_config.table_filter = |_| true;
}
let mut write_lock = self_1.beacon_nodes.write();
let index = write_lock.len();
// We create the beacon node without holding the lock, so that the lock isn't held
// across the await. This is only correct if this function never runs in parallel
// with itself (which at the time of writing, it does not).
let index = self_1.beacon_nodes.read().len();
let beacon_node = LocalBeaconNode::production(
self.context.service_context(format!("node_{}", index)),
beacon_config,
)
.await?;
write_lock.push(beacon_node);
self_1.beacon_nodes.write().push(beacon_node);
Ok(())
}