Skip to content

Commit

Permalink
Fix more warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaseizinger committed Apr 16, 2023
1 parent adbb303 commit 498b1c4
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 46 deletions.
23 changes: 0 additions & 23 deletions clippy-warnings.json

This file was deleted.

4 changes: 2 additions & 2 deletions muxers/mplex/src/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl nohash_hasher::IsEnabled for LocalStreamId {}
/// and mapped by the receiver to `LocalStreamId`s via
/// [`RemoteStreamId::into_local()`].
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub struct RemoteStreamId {
pub(crate) struct RemoteStreamId {
num: u64,
role: Endpoint,
}
Expand Down Expand Up @@ -176,7 +176,7 @@ impl Frame<RemoteStreamId> {
}
}

pub struct Codec {
pub(crate) struct Codec {
varint_decoder: codec::Uvi<u64>,
decoder_state: CodecDecodeState,
}
Expand Down
2 changes: 1 addition & 1 deletion muxers/mplex/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl fmt::Display for ConnectionId {
}
}
/// A multiplexed I/O stream.
pub struct Multiplexed<C> {
pub(crate) struct Multiplexed<C> {
/// A unique ID for the multiplexed stream (i.e. connection).
id: ConnectionId,
/// The current operating status of the multiplex stream.
Expand Down
2 changes: 1 addition & 1 deletion protocols/kad/src/kbucket_priv/bucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub struct Position(usize);
/// A `KBucket` is a list of up to `K_VALUE` keys and associated values,
/// ordered from least-recently connected to most-recently connected.
#[derive(Debug, Clone)]
pub struct KBucket<TKey, TVal> {
pub(crate) struct KBucket<TKey, TVal> {
/// The nodes contained in the bucket.
nodes: ArrayVec<Node<TKey, TVal>, { K_VALUE.get() }>,

Expand Down
4 changes: 2 additions & 2 deletions protocols/mdns/src/behaviour/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use std::{
};

/// Interface that must be implemented by the different runtimes to use the [`UdpSocket`] in async mode
pub(crate) trait AsyncSocket: Unpin + Send + 'static {
pub trait AsyncSocket: Unpin + Send + 'static {
/// Create the async socket from the [`std::net::UdpSocket`]
fn from_std(socket: UdpSocket) -> std::io::Result<Self>
where
Expand Down Expand Up @@ -94,7 +94,7 @@ pub mod asio {
#[cfg(feature = "tokio")]
pub mod tokio {
use super::*;
use tokio::{io::ReadBuf, net::UdpSocket as TkUdpSocket};
use ::tokio::{io::ReadBuf, net::UdpSocket as TkUdpSocket};

/// Tokio ASync Socket`
pub type TokioUdpSocket = TkUdpSocket;
Expand Down
4 changes: 2 additions & 2 deletions protocols/mdns/src/behaviour/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct Timer<T> {
}

/// Builder interface to homogenize the different implementations
pub(crate) trait Builder: Send + Unpin + 'static {
pub trait Builder: Send + Unpin + 'static {
/// Creates a timer that emits an event once at the given time instant.
fn at(instant: Instant) -> Self;

Expand Down Expand Up @@ -87,12 +87,12 @@ pub mod asio {
#[cfg(feature = "tokio")]
pub mod tokio {
use super::*;
use ::tokio::time::{self, Instant as TokioInstant, Interval, MissedTickBehavior};
use futures::Stream;
use std::{
pin::Pin,
task::{Context, Poll},
};
use tokio::time::{self, Instant as TokioInstant, Interval, MissedTickBehavior};

/// Tokio wrapper
pub type TokioTimer = Timer<Interval>;
Expand Down
2 changes: 1 addition & 1 deletion protocols/relay/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub mod inbound_stop;
pub(crate) mod outbound_hop;
pub mod outbound_stop;

pub(crate) const HOP_PROTOCOL_NAME: &[u8; 31] = b"/libp2p/circuit/relay/0.2.0/hop";
pub const HOP_PROTOCOL_NAME: &[u8; 31] = b"/libp2p/circuit/relay/0.2.0/hop";
pub const STOP_PROTOCOL_NAME: &[u8; 32] = b"/libp2p/circuit/relay/0.2.0/stop";

const MAX_MESSAGE_SIZE: usize = 4096;
Expand Down
2 changes: 1 addition & 1 deletion swarm/src/connection/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl<THandler: ConnectionHandler> fmt::Debug for Pool<THandler> {

/// Event that can happen on the `Pool`.
#[derive(Debug)]
pub enum PoolEvent<THandler: ConnectionHandler> {
pub(crate) enum PoolEvent<THandler: ConnectionHandler> {
/// A new connection has been established.
ConnectionEstablished {
id: ConnectionId,
Expand Down
4 changes: 2 additions & 2 deletions swarm/src/connection/pool/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub enum EstablishedConnectionEvent<THandler: ConnectionHandler> {
},
}

pub async fn new_for_pending_outgoing_connection(
pub(crate) async fn new_for_pending_outgoing_connection(
connection_id: ConnectionId,
dial: ConcurrentDial,
abort_receiver: oneshot::Receiver<Void>,
Expand Down Expand Up @@ -167,7 +167,7 @@ pub async fn new_for_pending_incoming_connection<TFut>(
}
}

pub async fn new_for_established_connection<THandler>(
pub(crate) async fn new_for_established_connection<THandler>(
connection_id: ConnectionId,
peer_id: PeerId,
mut connection: crate::connection::Connection<THandler>,
Expand Down
10 changes: 5 additions & 5 deletions transports/noise/src/io/handshake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ where
}

/// A future for receiving a Noise handshake message with an empty payload.
pub async fn recv_empty<T>(state: &mut State<T>) -> Result<(), NoiseError>
pub(crate) async fn recv_empty<T>(state: &mut State<T>) -> Result<(), NoiseError>
where
T: AsyncRead + Unpin,
{
Expand All @@ -159,7 +159,7 @@ where
}

/// A future for sending a Noise handshake message with an empty payload.
pub async fn send_empty<T>(state: &mut State<T>) -> Result<(), NoiseError>
pub(crate) async fn send_empty<T>(state: &mut State<T>) -> Result<(), NoiseError>
where
T: AsyncWrite + Unpin,
{
Expand All @@ -172,7 +172,7 @@ where
///
/// In case `expected_key` is passed, this function will fail if the received key does not match the expected key.
/// In case the remote does not send us a key, the expected key is assumed to be the remote's key.
pub async fn recv_identity<T>(state: &mut State<T>) -> Result<(), NoiseError>
pub(crate) async fn recv_identity<T>(state: &mut State<T>) -> Result<(), NoiseError>
where
T: AsyncRead + Unpin,
{
Expand Down Expand Up @@ -231,7 +231,7 @@ where
}

/// Send a Noise handshake message with a payload identifying the local node to the remote.
pub async fn send_identity<T>(state: &mut State<T>) -> Result<(), NoiseError>
pub(crate) async fn send_identity<T>(state: &mut State<T>) -> Result<(), NoiseError>
where
T: AsyncWrite + Unpin,
{
Expand Down Expand Up @@ -261,7 +261,7 @@ where
}

/// Send a Noise handshake message with a payload identifying the local node to the remote.
pub async fn send_signature_only<T>(state: &mut State<T>) -> Result<(), NoiseError>
pub(crate) async fn send_signature_only<T>(state: &mut State<T>) -> Result<(), NoiseError>
where
T: AsyncWrite + Unpin,
{
Expand Down
8 changes: 4 additions & 4 deletions transports/quic/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl From<Config> for QuinnConfig {

/// Channel used to send commands to the [`Driver`].
#[derive(Debug, Clone)]
pub struct Channel {
pub(crate) struct Channel {
/// Channel to the background of the endpoint.
to_endpoint: mpsc::Sender<ToEndpoint>,
/// Address that the socket is bound to.
Expand All @@ -179,7 +179,7 @@ pub struct Channel {

impl Channel {
/// Builds a new endpoint that is listening on the [`SocketAddr`].
pub fn new_bidirectional<P: Provider>(
pub(crate) fn new_bidirectional<P: Provider>(
quinn_config: QuinnConfig,
socket_addr: SocketAddr,
) -> Result<(Self, mpsc::Receiver<Connection>), Error> {
Expand All @@ -190,7 +190,7 @@ impl Channel {
}

/// Builds a new endpoint that only supports outbound connections.
pub fn new_dialer<P: Provider>(
pub(crate) fn new_dialer<P: Provider>(
quinn_config: QuinnConfig,
socket_family: SocketFamily,
) -> Result<Self, Error> {
Expand Down Expand Up @@ -294,7 +294,7 @@ pub struct Disconnected {}

/// Message sent to the endpoint background task.
#[derive(Debug)]
pub enum ToEndpoint {
pub(crate) enum ToEndpoint {
/// Instruct the [`quinn_proto::Endpoint`] to start connecting to the given address.
Dial {
/// UDP address to connect to.
Expand Down
4 changes: 2 additions & 2 deletions transports/webrtc/src/tokio/udp_mux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub(crate) struct NewAddr {

/// An event emitted by [`UDPMuxNewAddr`] when it's polled.
#[derive(Debug)]
pub enum UDPMuxEvent {
pub(crate) enum UDPMuxEvent {
/// Connection error. UDP mux should be stopped.
Error(std::io::Error),
/// Got a [`NewAddr`] from the socket.
Expand All @@ -67,7 +67,7 @@ pub enum UDPMuxEvent {
///
/// - It has been rewritten to work without locks and channels instead.
/// - It reports previously unseen addresses instead of ignoring them.
pub struct UDPMuxNewAddr {
pub(crate) struct UDPMuxNewAddr {
udp_sock: UdpSocket,

listen_addr: SocketAddr,
Expand Down

0 comments on commit 498b1c4

Please sign in to comment.