mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 02:42:38 +00:00
Apply clippy suggestions
This commit is contained in:
@@ -13,7 +13,7 @@ use libp2p::core::swarm::{
|
||||
use libp2p::{Multiaddr, PeerId};
|
||||
pub use methods::{HelloMessage, RPCMethod, RPCRequest, RPCResponse};
|
||||
pub use protocol::{RPCEvent, RPCProtocol};
|
||||
use slog::{debug, o};
|
||||
use slog::o;
|
||||
use std::marker::PhantomData;
|
||||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
|
||||
@@ -65,7 +65,7 @@ where
|
||||
|
||||
fn inject_connected(&mut self, peer_id: PeerId, connected_point: ConnectedPoint) {
|
||||
// if initialised the connection, report this upwards to send the HELLO request
|
||||
if let ConnectedPoint::Dialer { address } = connected_point {
|
||||
if let ConnectedPoint::Dialer { address: _ } = connected_point {
|
||||
self.events.push(NetworkBehaviourAction::GenerateEvent(
|
||||
RPCMessage::PeerDialed(peer_id),
|
||||
));
|
||||
|
||||
@@ -84,11 +84,11 @@ fn decode(packet: Vec<u8>) -> Result<RPCEvent, DecodeError> {
|
||||
RPCMethod::Unknown => return Err(DecodeError::UnknownRPCMethod),
|
||||
};
|
||||
|
||||
return Ok(RPCEvent::Request {
|
||||
Ok(RPCEvent::Request {
|
||||
id,
|
||||
method_id,
|
||||
body,
|
||||
});
|
||||
})
|
||||
}
|
||||
// we have received a response
|
||||
else {
|
||||
@@ -99,11 +99,11 @@ fn decode(packet: Vec<u8>) -> Result<RPCEvent, DecodeError> {
|
||||
}
|
||||
RPCMethod::Unknown => return Err(DecodeError::UnknownRPCMethod),
|
||||
};
|
||||
return Ok(RPCEvent::Response {
|
||||
Ok(RPCEvent::Response {
|
||||
id,
|
||||
method_id,
|
||||
result,
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,13 +73,12 @@ impl Service {
|
||||
let mut subscribed_topics = vec![];
|
||||
for topic in config.topics {
|
||||
let t = TopicBuilder::new(topic.to_string()).build();
|
||||
match swarm.subscribe(t) {
|
||||
true => {
|
||||
trace!(log, "Subscribed to topic: {:?}", topic);
|
||||
subscribed_topics.push(topic);
|
||||
}
|
||||
false => warn!(log, "Could not subscribe to topic: {:?}", topic),
|
||||
};
|
||||
if swarm.subscribe(t) {
|
||||
trace!(log, "Subscribed to topic: {:?}", topic);
|
||||
subscribed_topics.push(topic);
|
||||
} else {
|
||||
warn!(log, "Could not subscribe to topic: {:?}", topic)
|
||||
}
|
||||
}
|
||||
info!(log, "Subscribed to topics: {:?}", subscribed_topics);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user