Skip to content

Commit

Permalink
chore: touchups
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Jun 15, 2024
1 parent 340df87 commit 081d559
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 21 deletions.
18 changes: 8 additions & 10 deletions crates/primitives/src/chain/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,14 @@ use crate::{
Hardfork, Head, Header, NamedChain, NodeRecord, SealedHeader, B256, EMPTY_OMMER_ROOT_HASH,
MAINNET_DEPOSIT_CONTRACT, U256,
};
use derive_more::From;
use once_cell::sync::Lazy;
use reth_trie_common::root::state_root_ref_unhashed;
use serde::{Deserialize, Serialize};

#[cfg(feature = "std")]
use std::{collections::BTreeMap, sync::Arc};

pub use alloy_eips::eip1559::BaseFeeParams;

use core::{
fmt,
fmt::{Display, Formatter},
};
use derive_more::From;
use once_cell::sync::Lazy;
use reth_trie_common::root::state_root_ref_unhashed;
use serde::{Deserialize, Serialize};

#[cfg(not(feature = "std"))]
use alloc::{
Expand All @@ -33,6 +27,10 @@ use alloc::{
sync::Arc,
vec::Vec,
};
#[cfg(feature = "std")]
use std::{collections::BTreeMap, sync::Arc};

pub use alloy_eips::eip1559::BaseFeeParams;

#[cfg(feature = "optimism")]
pub(crate) use crate::{
Expand Down
3 changes: 1 addition & 2 deletions crates/primitives/src/transaction/legacy.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use crate::{keccak256, Bytes, ChainId, Signature, TxKind, TxType, B256, U256};
use alloy_rlp::{length_of_length, Encodable, Header};
use bytes::BytesMut;
use reth_codecs::{main_codec, Compact};

use core::mem;
use reth_codecs::{main_codec, Compact};

/// Legacy transaction.
#[main_codec]
Expand Down
3 changes: 1 addition & 2 deletions crates/primitives/src/transaction/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::{transaction::util::secp256k1, Address, B256, U256};
use alloy_primitives::Bytes;
use alloy_rlp::{Decodable, Encodable, Error as RlpError};
use bytes::Buf;
use core::mem;
use reth_codecs::{derive_arbitrary, Compact};
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -194,7 +193,7 @@ impl Signature {
/// Calculates a heuristic for the in-memory size of the [Signature].
#[inline]
pub const fn size(&self) -> usize {
mem::size_of::<Self>()
core::mem::size_of::<Self>()
}
}

Expand Down
1 change: 0 additions & 1 deletion crates/primitives/src/transaction/variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use crate::{
Address, Transaction, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash,
B256,
};

use core::ops::Deref;

/// Represents various different transaction formats used in reth.
Expand Down
10 changes: 4 additions & 6 deletions crates/primitives/src/withdrawal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ use reth_codecs::{main_codec, Compact};
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;

use core::{mem, slice};

/// Re-export from `alloy_eips`.
#[doc(inline)]
pub use alloy_eips::eip4895::Withdrawal;
Expand Down Expand Up @@ -42,22 +40,22 @@ impl Withdrawals {
/// Calculate the total size, including capacity, of the Withdrawals.
#[inline]
pub fn total_size(&self) -> usize {
self.capacity() * mem::size_of::<Withdrawal>()
self.capacity() * size_of::<Withdrawal>()
}

/// Calculate a heuristic for the in-memory size of the [Withdrawals].
#[inline]
pub fn size(&self) -> usize {
self.len() * mem::size_of::<Withdrawal>()
self.len() * size_of::<Withdrawal>()
}

/// Get an iterator over the Withdrawals.
pub fn iter(&self) -> slice::Iter<'_, Withdrawal> {
pub fn iter(&self) -> core::slice::Iter<'_, Withdrawal> {
self.0.iter()
}

/// Get a mutable iterator over the Withdrawals.
pub fn iter_mut(&mut self) -> slice::IterMut<'_, Withdrawal> {
pub fn iter_mut(&mut self) -> core::slice::IterMut<'_, Withdrawal> {
self.0.iter_mut()
}

Expand Down

0 comments on commit 081d559

Please sign in to comment.