From 1f79997ca97bbab0a3fa551faaa311477e319f0f Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Tue, 9 Jul 2024 19:18:48 +0200 Subject: [PATCH] chore: fix unnameable types (#1029) --- Cargo.toml | 17 ++++++++++------- crates/contract/src/eth_call.rs | 2 ++ crates/network/src/any/mod.rs | 1 + crates/network/src/lib.rs | 2 +- crates/provider/src/fillers/mod.rs | 2 +- crates/provider/src/lib.rs | 4 ++-- crates/provider/src/provider/call.rs | 1 + crates/provider/src/provider/with_block.rs | 1 + crates/pubsub/src/lib.rs | 5 ++++- crates/rpc-client/src/batch.rs | 1 + crates/rpc-client/src/lib.rs | 2 +- crates/rpc-types-eth/src/lib.rs | 2 +- crates/serde/src/other/arbitrary_.rs | 1 + crates/serde/src/quantity.rs | 1 + crates/signer-local/src/lib.rs | 2 +- crates/transport/src/error.rs | 2 ++ crates/transport/src/lib.rs | 2 +- 17 files changed, 32 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0831013b862..56deb3c06c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/crates/contract/src/eth_call.rs b/crates/contract/src/eth_call.rs index 3c601a62d20..c4dd8c227bb 100644 --- a/crates/contract/src/eth_call.rs +++ b/crates/contract/src/eth_call.rs @@ -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 {} @@ -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, diff --git a/crates/network/src/any/mod.rs b/crates/network/src/any/mod.rs index 8cc7bf2bbe1..2acb0a1a5a1 100644 --- a/crates/network/src/any/mod.rs +++ b/crates/network/src/any/mod.rs @@ -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); diff --git a/crates/network/src/lib.rs b/crates/network/src/lib.rs index e0a63d2a233..54431385f32 100644 --- a/crates/network/src/lib.rs +++ b/crates/network/src/lib.rs @@ -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; diff --git a/crates/provider/src/fillers/mod.rs b/crates/provider/src/fillers/mod.rs index 0d0026e21cc..e2321f45ce0 100644 --- a/crates/provider/src/fillers/mod.rs +++ b/crates/provider/src/fillers/mod.rs @@ -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; diff --git a/crates/provider/src/lib.rs b/crates/provider/src/lib.rs index a44cc35b79a..314e1ff2494 100644 --- a/crates/provider/src/lib.rs +++ b/crates/provider/src/lib.rs @@ -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 = crate::RootProvider, 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 = crate::RootProvider, N>; diff --git a/crates/provider/src/provider/call.rs b/crates/provider/src/provider/call.rs index a92adef420b..c79d3944c36 100644 --- a/crates/provider/src/provider/call.rs +++ b/crates/provider/src/provider/call.rs @@ -39,6 +39,7 @@ impl 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>, diff --git a/crates/provider/src/provider/with_block.rs b/crates/provider/src/provider/with_block.rs index 57e9c419059..808b72a15f6 100644 --- a/crates/provider/src/provider/with_block.rs +++ b/crates/provider/src/provider/with_block.rs @@ -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 where T: Transport + Clone, diff --git a/crates/pubsub/src/lib.rs b/crates/pubsub/src/lib.rs index 646b00cb30c..fae9a82ac38 100644 --- a/crates/pubsub/src/lib.rs +++ b/crates/pubsub/src/lib.rs @@ -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, +}; diff --git a/crates/rpc-client/src/batch.rs b/crates/rpc-client/src/batch.rs index ab45295405e..7affdac2994 100644 --- a/crates/rpc-client/src/batch.rs +++ b/crates/rpc-client/src/batch.rs @@ -63,6 +63,7 @@ where #[pin_project::pin_project(project = CallStateProj)] #[derive(Debug)] +#[allow(unnameable_types)] pub enum BatchFuture { Prepared { transport: Conn, diff --git a/crates/rpc-client/src/lib.rs b/crates/rpc-client/src/lib.rs index 37148500650..10cab0096ab 100644 --- a/crates/rpc-client/src/lib.rs +++ b/crates/rpc-client/src/lib.rs @@ -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}; diff --git a/crates/rpc-types-eth/src/lib.rs b/crates/rpc-types-eth/src/lib.rs index 335066e97e9..46a5f3b4bd6 100644 --- a/crates/rpc-types-eth/src/lib.rs +++ b/crates/rpc-types-eth/src/lib.rs @@ -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; diff --git a/crates/serde/src/other/arbitrary_.rs b/crates/serde/src/other/arbitrary_.rs index a1cf4b2b2d0..53c92799c80 100644 --- a/crates/serde/src/other/arbitrary_.rs +++ b/crates/serde/src/other/arbitrary_.rs @@ -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), diff --git a/crates/serde/src/quantity.rs b/crates/serde/src/quantity.rs index 2e404ec5ada..53974b9a684 100644 --- a/crates/serde/src/quantity.rs +++ b/crates/serde/src/quantity.rs @@ -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 { diff --git a/crates/signer-local/src/lib.rs b/crates/signer-local/src/lib.rs index 641791f3f5d..a9a7f3e25a5 100644 --- a/crates/signer-local/src/lib.rs +++ b/crates/signer-local/src/lib.rs @@ -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; diff --git a/crates/transport/src/error.rs b/crates/transport/src/error.rs index 55b55f1bc1c..17f4eda4e1e 100644 --- a/crates/transport/src/error.rs +++ b/crates/transport/src/error.rs @@ -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, } diff --git a/crates/transport/src/lib.rs b/crates/transport/src/lib.rs index eed8a694221..f892049ea76 100644 --- a/crates/transport/src/lib.rs +++ b/crates/transport/src/lib.rs @@ -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;