mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-22 06:14:38 +00:00
Add various fixes to clippy lints
Thou shalt appease clippy
This commit is contained in:
@@ -216,9 +216,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
.iter()
|
||||
.map(|root| match self.get_block(root)? {
|
||||
Some(block) => Ok(block.body),
|
||||
None => Err(Error::DBInconsistent(
|
||||
format!("Missing block: {}", root).into(),
|
||||
)),
|
||||
None => Err(Error::DBInconsistent(format!("Missing block: {}", root))),
|
||||
})
|
||||
.collect();
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ impl<T: EthSpec, U: Store> Iterator for BlockRootsIterator<T, U> {
|
||||
return None;
|
||||
}
|
||||
|
||||
self.slot = self.slot - 1;
|
||||
self.slot -= 1;
|
||||
|
||||
match self.beacon_state.get_block_root(self.slot) {
|
||||
Ok(root) => Some(*root),
|
||||
@@ -73,7 +73,7 @@ impl<T: EthSpec, U: Store> Iterator for BlockRootsIterator<T, U> {
|
||||
|
||||
self.beacon_state.get_block_root(self.slot).ok().cloned()
|
||||
}
|
||||
_ => return None,
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,12 +57,12 @@ impl Config {
|
||||
|
||||
pub fn apply_cli_args(&mut self, args: &ArgMatches) -> Result<(), &'static str> {
|
||||
if let Some(listen_address_str) = args.value_of("listen-address") {
|
||||
let listen_addresses = listen_address_str.split(",").map(Into::into).collect();
|
||||
let listen_addresses = listen_address_str.split(',').map(Into::into).collect();
|
||||
self.listen_addresses = listen_addresses;
|
||||
}
|
||||
|
||||
if let Some(boot_addresses_str) = args.value_of("boot-nodes") {
|
||||
let boot_addresses = boot_addresses_str.split(",").map(Into::into).collect();
|
||||
let boot_addresses = boot_addresses_str.split(',').map(Into::into).collect();
|
||||
self.boot_nodes = boot_addresses;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ impl RequestId {
|
||||
}
|
||||
|
||||
/// Return the previous id.
|
||||
pub fn previous(&self) -> Self {
|
||||
pub fn previous(self) -> Self {
|
||||
Self(self.0 - 1)
|
||||
}
|
||||
}
|
||||
@@ -220,7 +220,7 @@ impl Encode for RPCEvent {
|
||||
} => SszContainer {
|
||||
is_request: true,
|
||||
id: (*id).into(),
|
||||
other: (*method_id).into(),
|
||||
other: *method_id,
|
||||
bytes: match body {
|
||||
RPCRequest::Hello(body) => body.as_ssz_bytes(),
|
||||
RPCRequest::Goodbye(body) => body.as_ssz_bytes(),
|
||||
@@ -237,7 +237,7 @@ impl Encode for RPCEvent {
|
||||
} => SszContainer {
|
||||
is_request: false,
|
||||
id: (*id).into(),
|
||||
other: (*method_id).into(),
|
||||
other: *method_id,
|
||||
bytes: match result {
|
||||
RPCResponse::Hello(response) => response.as_ssz_bytes(),
|
||||
RPCResponse::BeaconBlockRoots(response) => response.as_ssz_bytes(),
|
||||
|
||||
@@ -155,7 +155,7 @@ impl<T: BeaconChainTypes + 'static> MessageHandler<T> {
|
||||
if self
|
||||
.network_context
|
||||
.outstanding_outgoing_request_ids
|
||||
.remove(&(peer_id.clone(), id.clone()))
|
||||
.remove(&(peer_id.clone(), id))
|
||||
.is_none()
|
||||
{
|
||||
warn!(
|
||||
@@ -250,7 +250,7 @@ impl NetworkContext {
|
||||
let id = self.generate_request_id(&peer_id);
|
||||
|
||||
self.outstanding_outgoing_request_ids
|
||||
.insert((peer_id.clone(), id.clone()), Instant::now());
|
||||
.insert((peer_id.clone(), id), Instant::now());
|
||||
|
||||
self.send_rpc_event(
|
||||
peer_id,
|
||||
|
||||
Reference in New Issue
Block a user