.github/: Enforce no clippy warnings (#2148)

* Fix remaining clippy warnings.

Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
Thomas Eizinger
2021-07-26 19:22:46 +10:00
committed by GitHub
parent e437c009dc
commit 7877929af2
9 changed files with 13 additions and 8 deletions

3
.cargo/config.toml Normal file
View File

@ -0,0 +1,3 @@
[alias]
# Temporary solution to have clippy config in a single place until https://github.com/rust-lang/rust-clippy/blob/master/doc/roadmap-2021.md#lintstoml-configuration is shipped.
custom-clippy = "clippy -- -A clippy::type_complexity -A clippy::pedantic -A clippy::style -D warnings"

View File

@ -152,8 +152,7 @@ jobs:
- name: Run cargo clippy - name: Run cargo clippy
uses: actions-rs/cargo@v1.0.3 uses: actions-rs/cargo@v1.0.3
with: with:
command: clippy command: custom-clippy # cargo alias to allow reuse of config locally
args: -- -A clippy::type_complexity -A clippy::pedantic -A clippy::style
integration-test: integration-test:
name: Integration tests name: Integration tests

View File

@ -756,6 +756,7 @@ impl NetworkBehaviour for Relay {
} }
#[derive(Debug)] #[derive(Debug)]
#[allow(clippy::large_enum_variant)]
pub enum BehaviourToListenerMsg { pub enum BehaviourToListenerMsg {
ConnectionToRelayEstablished, ConnectionToRelayEstablished,
IncomingRelayedConnection { IncomingRelayedConnection {

View File

@ -733,6 +733,7 @@ impl ProtocolsHandler for RelayHandler {
} }
} }
#[allow(clippy::large_enum_variant)]
pub enum RelayOutboundOpenInfo { pub enum RelayOutboundOpenInfo {
Relay { Relay {
dst_peer_id: PeerId, dst_peer_id: PeerId,

View File

@ -76,7 +76,7 @@ impl upgrade::InboundUpgrade<NegotiatedSubstream> for RelayListen {
let msg: bytes::BytesMut = substream let msg: bytes::BytesMut = substream
.next() .next()
.await .await
.ok_or(std::io::Error::new(std::io::ErrorKind::UnexpectedEof, ""))??; .ok_or_else(|| std::io::Error::new(std::io::ErrorKind::UnexpectedEof, ""))??;
let CircuitRelay { let CircuitRelay {
r#type, r#type,
src_peer, src_peer,

View File

@ -100,7 +100,7 @@ impl upgrade::OutboundUpgrade<NegotiatedSubstream> for OutgoingDstReq {
substream substream
.next() .next()
.await .await
.ok_or(OutgoingDstReqError::Io(std::io::Error::new( .ok_or_else(|| OutgoingDstReqError::Io(std::io::Error::new(
std::io::ErrorKind::UnexpectedEof, std::io::ErrorKind::UnexpectedEof,
"", "",
)))??; )))??;

View File

@ -87,7 +87,7 @@ impl upgrade::OutboundUpgrade<NegotiatedSubstream> for OutgoingRelayReq {
}), }),
dst_peer: Some(circuit_relay::Peer { dst_peer: Some(circuit_relay::Peer {
id: dst_id.to_bytes(), id: dst_id.to_bytes(),
addrs: vec![dst_address.unwrap_or(Multiaddr::empty()).to_vec()], addrs: vec![dst_address.unwrap_or_else(Multiaddr::empty).to_vec()],
}), }),
code: None, code: None,
}; };
@ -107,7 +107,7 @@ impl upgrade::OutboundUpgrade<NegotiatedSubstream> for OutgoingRelayReq {
substream substream
.next() .next()
.await .await
.ok_or(OutgoingRelayReqError::Io(std::io::Error::new( .ok_or_else(|| OutgoingRelayReqError::Io(std::io::Error::new(
std::io::ErrorKind::UnexpectedEof, std::io::ErrorKind::UnexpectedEof,
"", "",
)))??; )))??;

View File

@ -198,7 +198,7 @@ impl<T: Transport + Clone> Transport for RelayTransport<T> {
}; };
let (to_listener, from_behaviour) = mpsc::channel(0); let (to_listener, from_behaviour) = mpsc::channel(0);
let mut to_behaviour = self.to_behaviour.clone(); let mut to_behaviour = self.to_behaviour;
let msg_to_behaviour = Some( let msg_to_behaviour = Some(
async move { async move {
to_behaviour to_behaviour
@ -242,7 +242,7 @@ impl<T: Transport + Clone> Transport for RelayTransport<T> {
let relay_addr = relay_addr.ok_or(RelayError::MissingRelayAddr)?; let relay_addr = relay_addr.ok_or(RelayError::MissingRelayAddr)?;
let dst_peer_id = dst_peer_id.ok_or(RelayError::MissingDstPeerId)?; let dst_peer_id = dst_peer_id.ok_or(RelayError::MissingDstPeerId)?;
let mut to_behaviour = self.to_behaviour.clone(); let mut to_behaviour = self.to_behaviour;
Ok(EitherFuture::Second( Ok(EitherFuture::Second(
async move { async move {
let (tx, rx) = oneshot::channel(); let (tx, rx) = oneshot::channel();

View File

@ -330,6 +330,7 @@ where
/// The possible errors of a [`GenDnsConfig`] wrapped transport. /// The possible errors of a [`GenDnsConfig`] wrapped transport.
#[derive(Debug)] #[derive(Debug)]
#[allow(clippy::large_enum_variant)]
pub enum DnsErr<TErr> { pub enum DnsErr<TErr> {
/// The underlying transport encountered an error. /// The underlying transport encountered an error.
Transport(TErr), Transport(TErr),