protocols/: Fix clippy and fmt warnings (#2433)

* protocols/mdns: fix clippy::to-string-in-format-args

* protocols/gossipsub: fix rustfmt error
This commit is contained in:
Elena Frank
2022-01-13 19:35:20 +01:00
committed by GitHub
parent 74f31f1266
commit ddc035170d
2 changed files with 7 additions and 3 deletions

View File

@ -211,9 +211,11 @@ impl ProtocolsHandler for GossipsubHandler {
fn inject_fully_negotiated_inbound( fn inject_fully_negotiated_inbound(
&mut self, &mut self,
(substream, peer_kind): <Self::InboundProtocol as InboundUpgrade<NegotiatedSubstream>>::Output, protocol: <Self::InboundProtocol as InboundUpgrade<NegotiatedSubstream>>::Output,
_info: Self::InboundOpenInfo, _info: Self::InboundOpenInfo,
) { ) {
let (substream, peer_kind) = protocol;
// If the peer doesn't support the protocol, reject all substreams // If the peer doesn't support the protocol, reject all substreams
if self.protocol_unsupported { if self.protocol_unsupported {
return; return;
@ -233,9 +235,11 @@ impl ProtocolsHandler for GossipsubHandler {
fn inject_fully_negotiated_outbound( fn inject_fully_negotiated_outbound(
&mut self, &mut self,
(substream, peer_kind): <Self::OutboundProtocol as OutboundUpgrade<NegotiatedSubstream>>::Output, protocol: <Self::OutboundProtocol as OutboundUpgrade<NegotiatedSubstream>>::Output,
message: Self::OutboundOpenInfo, message: Self::OutboundOpenInfo,
) { ) {
let (substream, peer_kind) = protocol;
// If the peer doesn't support the protocol, reject all substreams // If the peer doesn't support the protocol, reject all substreams
if self.protocol_unsupported { if self.protocol_unsupported {
return; return;

View File

@ -127,7 +127,7 @@ pub fn build_query_response(
// Encode the addresses as TXT records, and multiple TXT records into a // Encode the addresses as TXT records, and multiple TXT records into a
// response packet. // response packet.
for addr in addresses { for addr in addresses {
let txt_to_send = format!("dnsaddr={}/p2p/{}", addr.to_string(), peer_id.to_base58()); let txt_to_send = format!("dnsaddr={}/p2p/{}", addr, peer_id.to_base58());
let mut txt_record = Vec::with_capacity(txt_to_send.len()); let mut txt_record = Vec::with_capacity(txt_to_send.len());
match append_txt_record(&mut txt_record, &peer_name_bytes, ttl, &txt_to_send) { match append_txt_record(&mut txt_record, &peer_name_bytes, ttl, &txt_to_send) {
Ok(()) => { Ok(()) => {