Skip to content

Commit

Permalink
chore(autonat, gossipsub, relay, quic): implement latest clippy changes
Browse files Browse the repository at this point in the history
I implemented the latest clippy suggestions (again). With those changes the CI won't fail when these lints are merged.

Pull-Request: #4704.
  • Loading branch information
umgefahren authored Oct 22, 2023
1 parent ed02a10 commit b663779
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion protocols/autonat/tests/test_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ async fn test_dial_multiple_addr() {
let dial_errors = concurrent_dial_errors.unwrap();

// The concurrent dial might not be fast enough to produce a dial error.
if let Some((addr, _)) = dial_errors.get(0) {
if let Some((addr, _)) = dial_errors.first() {
assert_eq!(addr, &dial_addresses[0]);
}

Expand Down
2 changes: 1 addition & 1 deletion protocols/gossipsub/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3516,7 +3516,7 @@ fn peer_removed_from_mesh(
.get(&peer_id)
.expect("To be connected to peer.")
.connections
.get(0)
.first()
.expect("There should be at least one connection to a peer.");

if let Some(topics) = known_topics {
Expand Down
4 changes: 2 additions & 2 deletions protocols/gossipsub/src/behaviour/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ fn test_explicit_peer_reconnects() {
.gs_config(config)
.create_network();

let peer = others.get(0).unwrap();
let peer = others.first().unwrap();

//add peer as explicit peer
gs.add_explicit_peer(peer);
Expand Down Expand Up @@ -1464,7 +1464,7 @@ fn test_handle_graft_explicit_peer() {
.explicit(1)
.create_network();

let peer = peers.get(0).unwrap();
let peer = peers.first().unwrap();

gs.handle_graft(peer, topic_hashes.clone());

Expand Down
4 changes: 2 additions & 2 deletions protocols/relay/src/priv_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ impl NetworkBehaviour for Behaviour {
match self
.directly_connected_peers
.get(&relay_peer_id)
.and_then(|cs| cs.get(0))
.and_then(|cs| cs.first())
{
Some(connection_id) => ToSwarm::NotifyHandler {
peer_id: relay_peer_id,
Expand Down Expand Up @@ -332,7 +332,7 @@ impl NetworkBehaviour for Behaviour {
match self
.directly_connected_peers
.get(&relay_peer_id)
.and_then(|cs| cs.get(0))
.and_then(|cs| cs.first())
{
Some(connection_id) => ToSwarm::NotifyHandler {
peer_id: relay_peer_id,
Expand Down
2 changes: 1 addition & 1 deletion transports/quic/src/connection/connecting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl Connecting {
let certificates: Box<Vec<rustls::Certificate>> =
identity.downcast().expect("we rely on rustls feature; qed");
let end_entity = certificates
.get(0)
.first()
.expect("there should be exactly one certificate; qed");
let p2p_cert = libp2p_tls::certificate::parse(end_entity)
.expect("the certificate was validated during TLS handshake; qed");
Expand Down

0 comments on commit b663779

Please sign in to comment.