Skip to content

Commit ddc0351

Browse files
authored
protocols/: Fix clippy and fmt warnings (#2433)
* protocols/mdns: fix clippy::to-string-in-format-args * protocols/gossipsub: fix rustfmt error
1 parent 74f31f1 commit ddc0351

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

protocols/gossipsub/src/handler.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,11 @@ impl ProtocolsHandler for GossipsubHandler {
211211

212212
fn inject_fully_negotiated_inbound(
213213
&mut self,
214-
(substream, peer_kind): <Self::InboundProtocol as InboundUpgrade<NegotiatedSubstream>>::Output,
214+
protocol: <Self::InboundProtocol as InboundUpgrade<NegotiatedSubstream>>::Output,
215215
_info: Self::InboundOpenInfo,
216216
) {
217+
let (substream, peer_kind) = protocol;
218+
217219
// If the peer doesn't support the protocol, reject all substreams
218220
if self.protocol_unsupported {
219221
return;
@@ -233,9 +235,11 @@ impl ProtocolsHandler for GossipsubHandler {
233235

234236
fn inject_fully_negotiated_outbound(
235237
&mut self,
236-
(substream, peer_kind): <Self::OutboundProtocol as OutboundUpgrade<NegotiatedSubstream>>::Output,
238+
protocol: <Self::OutboundProtocol as OutboundUpgrade<NegotiatedSubstream>>::Output,
237239
message: Self::OutboundOpenInfo,
238240
) {
241+
let (substream, peer_kind) = protocol;
242+
239243
// If the peer doesn't support the protocol, reject all substreams
240244
if self.protocol_unsupported {
241245
return;

protocols/mdns/src/behaviour/iface/dns.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ pub fn build_query_response(
127127
// Encode the addresses as TXT records, and multiple TXT records into a
128128
// response packet.
129129
for addr in addresses {
130-
let txt_to_send = format!("dnsaddr={}/p2p/{}", addr.to_string(), peer_id.to_base58());
130+
let txt_to_send = format!("dnsaddr={}/p2p/{}", addr, peer_id.to_base58());
131131
let mut txt_record = Vec::with_capacity(txt_to_send.len());
132132
match append_txt_record(&mut txt_record, &peer_name_bytes, ttl, &txt_to_send) {
133133
Ok(()) => {

0 commit comments

Comments
 (0)