Skip to content

Commit

Permalink
chore: some lifetime simplifications (alloy-rs#1467)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger authored Oct 14, 2024
1 parent 618d96f commit fb2321b
Show file tree
Hide file tree
Showing 16 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion crates/consensus/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ pub(super) mod serde_bincode_compat {
}
}

impl<'a> SerializeAs<super::Header> for Header<'a> {
impl SerializeAs<super::Header> for Header<'_> {
fn serialize_as<S>(source: &super::Header, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/src/transaction/eip1559.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ pub(super) mod serde_bincode_compat {
}
}

impl<'a> SerializeAs<super::TxEip1559> for TxEip1559<'a> {
impl SerializeAs<super::TxEip1559> for TxEip1559<'_> {
fn serialize_as<S>(source: &super::TxEip1559, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/src/transaction/eip2930.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ pub(super) mod serde_bincode_compat {
}
}

impl<'a> SerializeAs<super::TxEip2930> for TxEip2930<'a> {
impl SerializeAs<super::TxEip2930> for TxEip2930<'_> {
fn serialize_as<S>(source: &super::TxEip2930, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/src/transaction/eip7702.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ pub(super) mod serde_bincode_compat {
}
}

impl<'a> SerializeAs<super::TxEip7702> for TxEip7702<'a> {
impl SerializeAs<super::TxEip7702> for TxEip7702<'_> {
fn serialize_as<S>(source: &super::TxEip7702, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/src/transaction/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl fmt::Display for TxType {
}

#[cfg(any(test, feature = "arbitrary"))]
impl<'a> arbitrary::Arbitrary<'a> for TxType {
impl arbitrary::Arbitrary<'_> for TxType {
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
Ok(u.int_in_range(0u8..=3)?.try_into().unwrap())
}
Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/src/transaction/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ pub(super) mod serde_bincode_compat {
}
}

impl<'a> SerializeAs<super::TxLegacy> for TxLegacy<'a> {
impl SerializeAs<super::TxLegacy> for TxLegacy<'_> {
fn serialize_as<S>(source: &super::TxLegacy, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down
4 changes: 2 additions & 2 deletions crates/contract/src/eth_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ where
}
}

impl<'req, 'coder, D, T, N> EthCall<'req, 'coder, D, T, N>
impl<'req, D, T, N> EthCall<'req, '_, D, T, N>
where
T: Transport + Clone,
N: Network,
Expand Down Expand Up @@ -132,7 +132,7 @@ where
decoder: &'coder D,
}

impl<'req, 'coder, D, T, N> std::future::Future for EthCallFut<'req, 'coder, D, T, N>
impl<D, T, N> std::future::Future for EthCallFut<'_, '_, D, T, N>
where
D: CallDecoder + Unpin,
T: Transport + Clone,
Expand Down
2 changes: 1 addition & 1 deletion crates/json-rpc/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl<'de> Deserialize<'de> for Id {
{
struct IdVisitor;

impl<'de> Visitor<'de> for IdVisitor {
impl Visitor<'_> for IdVisitor {
type Value = Id;

fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion crates/json-rpc/src/response/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl<'de, ErrData: Deserialize<'de>> Deserialize<'de> for ErrorPayload<ErrData>
{
struct FieldVisitor;

impl<'de> serde::de::Visitor<'de> for FieldVisitor {
impl serde::de::Visitor<'_> for FieldVisitor {
type Value = Field;

fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion crates/json-rpc/src/response/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ where
{
struct FieldVisitor;

impl<'de> serde::de::Visitor<'de> for FieldVisitor {
impl serde::de::Visitor<'_> for FieldVisitor {
type Value = Field;

fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down
4 changes: 2 additions & 2 deletions crates/network-primitives/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ impl<'a, T> BlockTransactionHashes<'a, T> {
}
}

impl<'a, T: TransactionResponse> Iterator for BlockTransactionHashes<'a, T> {
impl<T: TransactionResponse> Iterator for BlockTransactionHashes<'_, T> {
type Item = B256;

#[inline]
Expand Down Expand Up @@ -213,7 +213,7 @@ impl<T: TransactionResponse> DoubleEndedIterator for BlockTransactionHashes<'_,
}

#[cfg(feature = "std")]
impl<'a, T: TransactionResponse> std::iter::FusedIterator for BlockTransactionHashes<'a, T> {}
impl<T: TransactionResponse> std::iter::FusedIterator for BlockTransactionHashes<'_, T> {}

/// Determines how the `transactions` field of block should be filled.
///
Expand Down
9 changes: 4 additions & 5 deletions crates/provider/src/provider/eth_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ where
Polling,
}

impl<'req, T, N, Resp, Output, Map> core::fmt::Debug
for EthCallFutInner<'req, T, N, Resp, Output, Map>
impl<T, N, Resp, Output, Map> core::fmt::Debug for EthCallFutInner<'_, T, N, Resp, Output, Map>
where
T: Transport + Clone,
N: Network,
Expand All @@ -97,7 +96,7 @@ where
}
}

impl<'req, T, N, Resp, Output, Map> EthCallFut<'req, T, N, Resp, Output, Map>
impl<T, N, Resp, Output, Map> EthCallFut<'_, T, N, Resp, Output, Map>
where
T: Transport + Clone,
N: Network,
Expand Down Expand Up @@ -140,7 +139,7 @@ where
}
}

impl<'req, T, N, Resp, Output, Map> Future for EthCallFut<'req, T, N, Resp, Output, Map>
impl<T, N, Resp, Output, Map> Future for EthCallFut<'_, T, N, Resp, Output, Map>
where
T: Transport + Clone,
N: Network,
Expand Down Expand Up @@ -187,7 +186,7 @@ where
_pd: PhantomData<fn() -> (Resp, Output)>,
}

impl<'req, T, N, Resp> core::fmt::Debug for EthCall<'req, T, N, Resp>
impl<T, N, Resp> core::fmt::Debug for EthCall<'_, T, N, Resp>
where
T: Transport + Clone,
N: Network,
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc-client/src/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl<'a, T> BatchRequest<'a, T> {
}
}

impl<'a, Conn> BatchRequest<'a, Conn>
impl<Conn> BatchRequest<'_, Conn>
where
Conn: Transport + Clone,
{
Expand Down Expand Up @@ -170,7 +170,7 @@ where
}
}

impl<'a, T> IntoFuture for BatchRequest<'a, T>
impl<T> IntoFuture for BatchRequest<'_, T>
where
T: Transport + Clone,
{
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc-types-beacon/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ impl<'a> From<&'a ExecutionPayload> for BeaconExecutionPayload<'a> {
}
}

impl<'a> SerializeAs<ExecutionPayload> for BeaconExecutionPayload<'a> {
impl SerializeAs<ExecutionPayload> for BeaconExecutionPayload<'_> {
fn serialize_as<S>(source: &ExecutionPayload, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc-types-eth/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl<'a> serde::Deserialize<'a> for Index {
{
struct IndexVisitor;

impl<'a> serde::de::Visitor<'a> for IndexVisitor {
impl serde::de::Visitor<'_> for IndexVisitor {
type Value = Index;

fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc-types-txpool/src/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct TxpoolInspectSummaryVisitor;

/// Walk through the deserializer to parse a txpool inspection summary into the
/// `TxpoolInspectSummary` struct.
impl<'de> Visitor<'de> for TxpoolInspectSummaryVisitor {
impl Visitor<'_> for TxpoolInspectSummaryVisitor {
type Value = TxpoolInspectSummary;

fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down

0 comments on commit fb2321b

Please sign in to comment.