Skip to content

Commit

Permalink
remove unecessary std imports
Browse files Browse the repository at this point in the history
  • Loading branch information
JackG-eth committed Jun 14, 2024
1 parent 6e52608 commit 09fb290
Show file tree
Hide file tree
Showing 16 changed files with 12 additions and 85 deletions.
6 changes: 1 addition & 5 deletions crates/primitives/src/account.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
use crate::revm_primitives::{Bytecode as RevmBytecode, Bytes};
use byteorder::{BigEndian, ReadBytesExt};
use bytes::Buf;
use core::ops::Deref;
use reth_codecs::Compact;
use revm_primitives::JumpTable;
use serde::{Deserialize, Serialize};
#[cfg(feature = "std")]
use std::ops::Deref;

#[cfg(not(feature = "std"))]
use core::ops::Deref;

pub use reth_primitives_traits::Account;

Expand Down
6 changes: 1 addition & 5 deletions crates/primitives/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ use crate::{
TransactionSignedEcRecovered, Withdrawals, B256,
};
use alloy_rlp::{RlpDecodable, RlpEncodable};
use core::{mem, ops::Deref};
#[cfg(any(test, feature = "arbitrary"))]
use proptest::prelude::{any, prop_compose};
use reth_codecs::derive_arbitrary;
use serde::{Deserialize, Serialize};
#[cfg(feature = "std")]
use std::{mem, ops::Deref};

pub use alloy_eips::eip1898::{
BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag, ForkBlock, RpcBlockHash,
Expand All @@ -17,9 +16,6 @@ pub use alloy_eips::eip1898::{
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;

#[cfg(not(feature = "std"))]
use core::{mem, ops::Deref};

// HACK(onbjerg): we need this to always set `requests` to `None` since we might otherwise generate
// a block with `None` withdrawals and `Some` requests, in which case we end up trying to decode the
// requests as withdrawals
Expand Down
8 changes: 1 addition & 7 deletions crates/primitives/src/chain/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,10 @@ use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize};

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

pub use alloy_eips::eip1559::BaseFeeParams;

#[cfg(not(feature = "std"))]
use core::{
fmt,
fmt::{Display, Formatter},
Expand Down
5 changes: 0 additions & 5 deletions crates/primitives/src/constants/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ use crate::{
revm_primitives::{address, b256},
B256, U256,
};

#[cfg(feature = "std")]
use std::time::Duration;

#[cfg(not(feature = "std"))]
use core::time::Duration;

#[cfg(feature = "optimism")]
Expand Down
7 changes: 0 additions & 7 deletions crates/primitives/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#[cfg(feature = "std")]
use std::{
fmt,
ops::{Deref, DerefMut},
};

#[cfg(not(feature = "std"))]
use core::{
fmt,
ops::{Deref, DerefMut},
Expand Down
7 changes: 1 addition & 6 deletions crates/primitives/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,12 @@ use crate::{
};
use alloy_rlp::{length_of_length, Decodable, Encodable};
use bytes::BufMut;
use core::{mem, ops::Deref};
#[cfg(any(test, feature = "arbitrary"))]
use proptest::prelude::*;
use reth_codecs::{add_arbitrary_tests, derive_arbitrary, main_codec, Compact};
use serde::{Deserialize, Serialize};

#[cfg(feature = "std")]
use std::{mem, ops::Deref};

#[cfg(not(feature = "std"))]
use core::{mem, ops::Deref};

/// Errors that can occur during header sanity checks.
#[derive(Debug, PartialEq, Eq)]
pub enum HeaderError {
Expand Down
6 changes: 1 addition & 5 deletions crates/primitives/src/integer_list.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
use bytes::BufMut;
use core::{fmt, ops::Deref};
use roaring::RoaringTreemap;
use serde::{
de::{SeqAccess, Unexpected, Visitor},
ser::SerializeSeq,
Deserialize, Deserializer, Serialize, Serializer,
};
#[cfg(feature = "std")]
use std::{fmt, ops::Deref};

#[cfg(not(feature = "std"))]
use core::{fmt, ops::Deref};

#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
Expand Down
7 changes: 1 addition & 6 deletions crates/primitives/src/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,11 @@ use reth_codecs::CompactZstd;
use reth_codecs::{add_arbitrary_tests, main_codec, Compact};

#[cfg(feature = "std")]
use std::{
cmp::Ordering,
ops::{Deref, DerefMut},
vec,
};
use std::vec;

#[cfg(not(feature = "std"))]
use alloc::{vec, vec::Vec};

#[cfg(not(feature = "std"))]
use core::{
cmp::Ordering,
ops::{Deref, DerefMut},
Expand Down
6 changes: 1 addition & 5 deletions crates/primitives/src/transaction/eip1559.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ use super::access_list::AccessList;
use crate::{keccak256, Bytes, ChainId, Signature, TxKind, TxType, B256, U256};
use alloy_rlp::{length_of_length, Decodable, Encodable, Header};
use bytes::BytesMut;
use reth_codecs::{main_codec, Compact};
#[cfg(feature = "std")]
use std::mem;

#[cfg(not(feature = "std"))]
use core::mem;
use reth_codecs::{main_codec, Compact};

/// A transaction with a priority fee ([EIP-1559](https://eips.ethereum.org/EIPS/eip-1559)).
#[main_codec]
Expand Down
6 changes: 1 addition & 5 deletions crates/primitives/src/transaction/eip2930.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ use super::access_list::AccessList;
use crate::{keccak256, Bytes, ChainId, Signature, TxKind, TxType, B256, U256};
use alloy_rlp::{length_of_length, Decodable, Encodable, Header};
use bytes::BytesMut;
use reth_codecs::{main_codec, Compact};
#[cfg(feature = "std")]
use std::mem;

#[cfg(not(feature = "std"))]
use core::mem;
use reth_codecs::{main_codec, Compact};

/// Transaction with an [`AccessList`] ([EIP-2930](https://eips.ethereum.org/EIPS/eip-2930)).
#[main_codec]
Expand Down
6 changes: 1 addition & 5 deletions crates/primitives/src/transaction/eip4844.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ use crate::{
B256, U256,
};
use alloy_rlp::{length_of_length, Decodable, Encodable, Header};
use core::mem;
use reth_codecs::{main_codec, Compact, CompactPlaceholder};
#[cfg(feature = "std")]
use std::mem;

#[cfg(feature = "c-kzg")]
use crate::kzg::KzgSettings;

#[cfg(not(feature = "std"))]
use core::mem;

#[cfg(not(feature = "std"))]
use alloc::vec::Vec;

Expand Down
3 changes: 0 additions & 3 deletions crates/primitives/src/transaction/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ 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};
#[cfg(feature = "std")]
use std::mem;

#[cfg(not(feature = "std"))]
use core::mem;

/// Legacy transaction.
Expand Down
6 changes: 1 addition & 5 deletions crates/primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@ use alloy_rlp::{
Decodable, Encodable, Error as RlpError, Header, EMPTY_LIST_CODE, EMPTY_STRING_CODE,
};
use bytes::Buf;
use core::mem;
use derive_more::{AsRef, Deref};
use once_cell::sync::Lazy;
use rayon::prelude::{IntoParallelIterator, ParallelIterator};
use reth_codecs::{add_arbitrary_tests, derive_arbitrary, Compact};
use serde::{Deserialize, Serialize};
#[cfg(feature = "std")]
use std::mem;

#[cfg(not(feature = "std"))]
use core::mem;

pub use access_list::{AccessList, AccessListItem};
pub use eip1559::TxEip1559;
Expand Down
6 changes: 1 addition & 5 deletions crates/primitives/src/transaction/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ 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};
#[cfg(feature = "std")]
use std::mem;

#[cfg(not(feature = "std"))]
use core::mem;

/// The order of the secp256k1 curve, divided by two. Signatures that should be checked according
/// to EIP-2 should have an S value less than or equal to this.
Expand Down
4 changes: 0 additions & 4 deletions crates/primitives/src/transaction/variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ use crate::{
B256,
};

#[cfg(feature = "std")]
use std::ops::Deref;

#[cfg(not(feature = "std"))]
use core::ops::Deref;

/// Represents various different transaction formats used in reth.
Expand Down
8 changes: 1 addition & 7 deletions crates/primitives/src/withdrawal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,12 @@
use alloy_rlp::{RlpDecodableWrapper, RlpEncodableWrapper};
use reth_codecs::{main_codec, Compact};

#[cfg(feature = "std")]
use std::{
mem,
ops::{Deref, DerefMut},
slice, vec,
};
use std::vec;

#[cfg(not(feature = "std"))]
use alloc::{vec, vec::Vec};

#[cfg(not(feature = "std"))]
use core::{
mem,
ops::{Deref, DerefMut},
Expand Down

0 comments on commit 09fb290

Please sign in to comment.