@@ -76,13 +76,12 @@ fn is_tcp_addr(addr: &Multiaddr) -> bool {
7676
7777 let mut iter = addr. iter ( ) ;
7878
79- let first = match iter. next ( ) {
80- None => return false ,
81- Some ( p) => p,
79+ let Some ( first) = iter. next ( ) else {
80+ return false ;
8281 } ;
83- let second = match iter . next ( ) {
84- None => return false ,
85- Some ( p ) => p ,
82+
83+ let Some ( second ) = iter . next ( ) else {
84+ return false ;
8685 } ;
8786
8887 matches ! ( first, Ip4 ( _) | Ip6 ( _) | Dns ( _) | Dns4 ( _) | Dns6 ( _) ) && matches ! ( second, Tcp ( _) )
@@ -120,9 +119,9 @@ pub struct Config {
120119 /// Application-specific version of the protocol family used by the peer,
121120 /// e.g. `ipfs/1.0.0` or `polkadot/1.0.0`.
122121 protocol_version : String ,
123- /// The key of the local node. Only the public key will be report on the wire.
122+ /// The key of the local node. Only the public key will be report on the wire.
124123 /// The behaviour will send signed [`PeerRecord`](libp2p_core::PeerRecord) in
125- /// its identify message only when supplied with a keypair.
124+ /// its identify message only when supplied with a keypair.
126125 local_key : Arc < KeyType > ,
127126 /// Name and version of the local peer implementation, similar to the
128127 /// `User-Agent` header in the HTTP protocol.
@@ -161,15 +160,15 @@ pub struct Config {
161160
162161impl Config {
163162 /// Creates a new configuration for the identify [`Behaviour`] that
164- /// advertises the given protocol version and public key.
163+ /// advertises the given protocol version and public key.
165164 /// Use [`new_with_signed_peer_record`](Config::new_with_signed_peer_record) for
166165 /// `signedPeerRecord` support.
167166 pub fn new ( protocol_version : String , local_public_key : PublicKey ) -> Self {
168167 Self :: new_with_key ( protocol_version, local_public_key)
169168 }
170169
171170 /// Creates a new configuration for the identify [`Behaviour`] that
172- /// advertises the given protocol version and public key.
171+ /// advertises the given protocol version and public key.
173172 /// The private key will be used to sign [`PeerRecord`](libp2p_core::PeerRecord)
174173 /// for verifiable address advertisement.
175174 pub fn new_with_signed_peer_record ( protocol_version : String , local_keypair : & Keypair ) -> Self {
@@ -532,9 +531,8 @@ impl NetworkBehaviour for Behaviour {
532531 _addresses : & [ Multiaddr ] ,
533532 _effective_role : Endpoint ,
534533 ) -> Result < Vec < Multiaddr > , ConnectionDenied > {
535- let peer = match maybe_peer {
536- None => return Ok ( vec ! [ ] ) ,
537- Some ( peer) => peer,
534+ let Some ( peer) = maybe_peer else {
535+ return Ok ( vec ! [ ] ) ;
538536 } ;
539537
540538 Ok ( self . discovered_peers . get ( & peer) )
0 commit comments