Skip to content

Commit

Permalink
transport: Fix clippy
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
  • Loading branch information
lexnv committed Aug 14, 2024
1 parent ed0826b commit dd45588
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/transport/common/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,8 @@ fn multiaddr_to_socket_address(
}

let maybe_peer = match iter.next() {
Some(Protocol::P2p(multihash)) => Some(
PeerId::from_multihash(multihash)
.map_err(|hash| AddressError::InvalidMultihash(hash))?,
),
Some(Protocol::P2p(multihash)) =>
Some(PeerId::from_multihash(multihash).map_err(AddressError::InvalidMultihash)?),
None => None,
protocol => {
tracing::error!(
Expand Down
2 changes: 1 addition & 1 deletion src/transport/manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1724,7 +1724,7 @@ impl TransportManager {
"open failure, but not the last transport",
);

self.opening_errors.entry(connection_id).or_insert(Default::default()).extend(errors);
self.opening_errors.entry(connection_id).or_default().extend(errors);
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/transport/quic/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ impl QuicConnection {
Role::Dialer => dialer_select_proto(stream, protocols, Version::V1).await,
Role::Listener => listener_select_proto(stream, protocols).await,
}
.map_err(|error| NegotiationError::MultistreamSelectError(error))?;
.map_err(NegotiationError::MultistreamSelectError)?;

tracing::trace!(target: LOG_TARGET, ?protocol, "protocol negotiated");

Expand Down
2 changes: 1 addition & 1 deletion src/transport/quic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ impl Transport for QuicTransport {

let future = async move {
let (socket_address, peer) = QuicListener::get_socket_address(&address)
.map_err(|err| DialError::AddressError(err))?;
.map_err(DialError::AddressError)?;
let peer =
peer.ok_or_else(|| DialError::AddressError(AddressError::PeerIdMissing))?;

Expand Down
2 changes: 1 addition & 1 deletion src/transport/tcp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ impl Stream for TcpTransport {
return Poll::Ready(Some(TransportEvent::DialFailure {
connection_id,
address,
error: error.into(),
error,
}));
}
}
Expand Down

0 comments on commit dd45588

Please sign in to comment.