Skip to content

Commit

Permalink
chore: fix unnameable types (alloy-rs#1029)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored and ben186 committed Jul 27, 2024
1 parent e987aae commit 1f79997
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 16 deletions.
17 changes: 10 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ homepage = "https://github.com/alloy-rs/alloy"
repository = "https://github.com/alloy-rs/alloy"
exclude = ["benches/", "tests/"]

[workspace.lints]
rust.missing-debug-implementations = "warn"
rust.missing-docs = "warn"
rust.unreachable-pub = "warn"
rust.unused-must-use = "deny"
rust.rust-2018-idioms = "deny"
rustdoc.all = "warn"
[workspace.lints.rust]
missing-debug-implementations = "warn"
missing-docs = "warn"
unreachable-pub = "warn"
unused-must-use = "deny"
rust-2018-idioms = "deny"
unnameable-types = "warn"

[workspace.lints.rustdoc]
all = "warn"

[workspace.lints.clippy]
all = "warn"
Expand Down
2 changes: 2 additions & 0 deletions crates/contract/src/eth_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::{Error, Result};
/// Raw coder.
const RAW_CODER: () = ();

#[allow(unnameable_types)]
mod private {
pub trait Sealed {}
impl Sealed for super::Function {}
Expand Down Expand Up @@ -121,6 +122,7 @@ where
/// decoder.
#[must_use = "futures do nothing unless you `.await` or poll them"]
#[derive(Clone, Debug)]
#[allow(unnameable_types)]
pub struct EthCallFut<'req, 'state, 'coder, D, T, N>
where
T: Transport + Clone,
Expand Down
1 change: 1 addition & 0 deletions crates/network/src/any/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use core::fmt;

mod builder;

/// Transaction type for a catch-all network.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[doc(alias = "AnyTransactionType")]
pub struct AnyTxType(u8);
Expand Down
2 changes: 1 addition & 1 deletion crates/network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod ethereum;
pub use ethereum::{Ethereum, EthereumWallet};

mod any;
pub use any::AnyNetwork;
pub use any::{AnyNetwork, AnyTxType};

pub use alloy_eips::eip2718;

Expand Down
2 changes: 1 addition & 1 deletion crates/provider/src/fillers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mod nonce;
pub use nonce::NonceFiller;

mod gas;
pub use gas::GasFiller;
pub use gas::{GasFillable, GasFiller};

mod join_fill;
pub use join_fill::JoinFill;
Expand Down
4 changes: 2 additions & 2 deletions crates/provider/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

#[cfg(any(test, feature = "reqwest"))]
/// Type alias for a [`RootProvider`] using the [`Http`] transport and a
/// reqwest client.
///
/// [`Http`]: alloy_transport_http::Http
#[cfg(any(test, feature = "reqwest"))]
pub type ReqwestProvider<N = alloy_network::Ethereum> =
crate::RootProvider<alloy_transport_http::Http<reqwest::Client>, N>;

#[cfg(feature = "hyper")]
/// Type alias for a [`RootProvider`] using the [`Http`] transport and a hyper
/// client.
///
/// [`Http`]: alloy_transport_http::Http
#[cfg(feature = "hyper")]
pub type HyperProvider<N = alloy_network::Ethereum> =
crate::RootProvider<alloy_transport_http::Http<alloy_transport_http::HyperClient>, N>;

Expand Down
1 change: 1 addition & 0 deletions crates/provider/src/provider/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ impl<N: Network> serde::Serialize for EthCallParams<'_, '_, N> {
/// The [`EthCallFut`] future is the future type for an `eth_call` RPC request.
#[derive(Clone, Debug)]
#[doc(hidden)] // Not public API.
#[allow(unnameable_types)]
#[pin_project::pin_project]
pub struct EthCallFut<'req, 'state, T, N, Resp, Output, Map>(
EthCallFutInner<'req, 'state, T, N, Resp, Output, Map>,
Expand Down
1 change: 1 addition & 0 deletions crates/provider/src/provider/with_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ where
/// A future for [`RpcWithBlock`]. Simple wrapper around [`RpcCall`].
#[derive(Debug, Clone)]
#[pin_project::pin_project]
#[allow(unnameable_types)]
pub struct RpcWithBlockFut<T, Params, Resp, Output, Map>
where
T: Transport + Clone,
Expand Down
5 changes: 4 additions & 1 deletion crates/pubsub/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ mod managers;
mod service;

mod sub;
pub use sub::{RawSubscription, Subscription, SubscriptionItem};
pub use sub::{
RawSubscription, SubAnyStream, SubResultStream, Subscription, SubscriptionItem,
SubscriptionStream,
};
1 change: 1 addition & 0 deletions crates/rpc-client/src/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ where

#[pin_project::pin_project(project = CallStateProj)]
#[derive(Debug)]
#[allow(unnameable_types)]
pub enum BatchFuture<Conn: Transport> {
Prepared {
transport: Conn,
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod call;
pub use call::RpcCall;

mod client;
pub use client::{ClientRef, RpcClient, WeakClient};
pub use client::{ClientRef, RpcClient, RpcClientInner, WeakClient};

mod poller;
pub use poller::{PollChannel, PollerBuilder};
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc-types-eth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mod block;
pub use block::*;

mod call;
pub use call::{Bundle, EthCallResponse, StateContext};
pub use call::{Bundle, EthCallResponse, StateContext, TransactionIndex};

pub mod error;

Expand Down
1 change: 1 addition & 0 deletions crates/serde/src/other/arbitrary_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ impl proptest::arbitrary::Arbitrary for OtherFields {

/// Redefinition of `serde_json::Value` for the purpose of implementing `Arbitrary`.
#[derive(Clone, Debug, arbitrary::Arbitrary)]
#[allow(unnameable_types)]
pub enum ArbitraryValue {
Null,
Bool(bool),
Expand Down
1 change: 1 addition & 0 deletions crates/serde/src/quantity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ pub mod vec {
}

/// Private implementation details of the [`quantity`](self) module.
#[allow(unnameable_types)]
mod private {
#[doc(hidden)]
pub trait ConvertRuint: Copy + Sized {
Expand Down
2 changes: 1 addition & 1 deletion crates/signer-local/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub use error::LocalSignerError;
#[cfg(feature = "mnemonic")]
mod mnemonic;
#[cfg(feature = "mnemonic")]
pub use mnemonic::MnemonicBuilder;
pub use mnemonic::{MnemonicBuilder, MnemonicBuilderError};

mod private_key;

Expand Down
2 changes: 2 additions & 0 deletions crates/transport/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ impl TransportErrorKind {
#[derive(Debug, thiserror::Error)]
#[error("HTTP error {status} with body: {body}")]
pub struct HttpError {
/// The HTTP status code.
pub status: u16,
/// The HTTP response body.
pub body: String,
}

Expand Down
2 changes: 1 addition & 1 deletion crates/transport/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub use common::Authorization;
mod error;
#[doc(hidden)]
pub use error::TransportErrorKind;
pub use error::{TransportError, TransportResult};
pub use error::{HttpError, TransportError, TransportResult};

mod r#trait;
pub use r#trait::Transport;
Expand Down

0 comments on commit 1f79997

Please sign in to comment.