mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-05-30 11:11:21 +00:00
chore: address latest clippy lints
I ran clippy on the current nightly and fixed issues found by it. Noteworthy are two instances of the [never_loop](https://rust-lang.github.io/rust-clippy/master/index.html#/never_loop) lint. Pull-Request: #4571.
This commit is contained in:
parent
d30eb9daa7
commit
665181efb5
@ -103,8 +103,8 @@ impl Behaviour {
|
|||||||
fn observed_addresses(&self) -> Vec<Multiaddr> {
|
fn observed_addresses(&self) -> Vec<Multiaddr> {
|
||||||
self.external_addresses
|
self.external_addresses
|
||||||
.iter()
|
.iter()
|
||||||
.cloned()
|
|
||||||
.filter(|a| !a.iter().any(|p| p == Protocol::P2pCircuit))
|
.filter(|a| !a.iter().any(|p| p == Protocol::P2pCircuit))
|
||||||
|
.cloned()
|
||||||
.map(|a| a.with(Protocol::P2p(self.local_peer_id)))
|
.map(|a| a.with(Protocol::P2p(self.local_peer_id)))
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
@ -330,7 +330,7 @@ impl From<Rpc> for proto::RPC {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|info| proto::PeerInfo {
|
.map(|info| proto::PeerInfo {
|
||||||
peer_id: info.peer_id.map(|id| id.to_bytes()),
|
peer_id: info.peer_id.map(|id| id.to_bytes()),
|
||||||
/// TODO, see https://github.com/libp2p/specs/pull/217
|
// TODO, see https://github.com/libp2p/specs/pull/217
|
||||||
signed_peer_record: None,
|
signed_peer_record: None,
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
|
@ -428,14 +428,12 @@ async fn connect(
|
|||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
swarm.dial(server_address.clone()).unwrap();
|
swarm.dial(server_address.clone()).unwrap();
|
||||||
|
|
||||||
let server_peer_id = loop {
|
let server_peer_id = match swarm.next().await.unwrap() {
|
||||||
match swarm.next().await.unwrap() {
|
SwarmEvent::ConnectionEstablished { peer_id, .. } => peer_id,
|
||||||
SwarmEvent::ConnectionEstablished { peer_id, .. } => break peer_id,
|
SwarmEvent::OutgoingConnectionError { peer_id, error, .. } => {
|
||||||
SwarmEvent::OutgoingConnectionError { peer_id, error, .. } => {
|
bail!("Outgoing connection error to {:?}: {:?}", peer_id, error);
|
||||||
bail!("Outgoing connection error to {:?}: {:?}", peer_id, error);
|
|
||||||
}
|
|
||||||
e => panic!("{e:?}"),
|
|
||||||
}
|
}
|
||||||
|
e => panic!("{e:?}"),
|
||||||
};
|
};
|
||||||
|
|
||||||
let duration = start.elapsed();
|
let duration = start.elapsed();
|
||||||
|
@ -2153,19 +2153,14 @@ mod tests {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
for mut transport in transports.into_iter() {
|
for mut transport in transports.into_iter() {
|
||||||
loop {
|
match futures::future::select(transport.select_next_some(), swarm.next()).await
|
||||||
match futures::future::select(transport.select_next_some(), swarm.next())
|
{
|
||||||
.await
|
future::Either::Left((TransportEvent::Incoming { .. }, _)) => {}
|
||||||
{
|
future::Either::Left(_) => {
|
||||||
future::Either::Left((TransportEvent::Incoming { .. }, _)) => {
|
panic!("Unexpected transport event.")
|
||||||
break;
|
}
|
||||||
}
|
future::Either::Right((e, _)) => {
|
||||||
future::Either::Left(_) => {
|
panic!("Expect swarm to not emit any event {e:?}")
|
||||||
panic!("Unexpected transport event.")
|
|
||||||
}
|
|
||||||
future::Either::Right((e, _)) => {
|
|
||||||
panic!("Expect swarm to not emit any event {e:?}")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user