cfg: replace std feature gate alloc imports with extern crate alloc (#10861)

This commit is contained in:
Thomas Coratger
2024-09-13 18:01:12 +02:00
committed by GitHub
parent 6fc81f2b70
commit 47d188cb8e
54 changed files with 39 additions and 163 deletions

View File

@ -1,12 +1,10 @@
#[cfg(not(feature = "std"))]
use crate::{hardforks::Hardforks, ForkCondition};
use alloc::{
format,
string::{String, ToString},
vec::Vec,
};
use crate::{hardforks::Hardforks, ForkCondition};
/// A container to pretty-print a hardfork.
///
/// The fork is formatted depending on its fork condition:

View File

@ -3,7 +3,6 @@
//! Previously version of Apache licenced [`ethereum-forkid`](https://crates.io/crates/ethereum-forkid).
use crate::Head;
#[cfg(not(feature = "std"))]
use alloc::{
collections::{BTreeMap, BTreeSet},
vec::Vec,
@ -22,8 +21,6 @@ use crc::*;
use proptest_derive::Arbitrary as PropTestArbitrary;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
#[cfg(feature = "std")]
use std::collections::{BTreeMap, BTreeSet};
const CRC_32_IEEE: Crc<u32> = Crc::<u32>::new(&CRC_32_ISO_HDLC);
const TIMESTAMP_BEFORE_ETHEREUM_MAINNET: u64 = 1_300_000_000;

View File

@ -1,10 +1,8 @@
use crate::{ChainHardforks, EthereumHardfork, ForkCondition};
use alloc::vec;
use alloy_primitives::U256;
use once_cell::sync::Lazy;
#[cfg(not(feature = "std"))]
use alloc::vec;
/// Dev hardforks
pub static DEV_HARDFORKS: Lazy<ChainHardforks> = Lazy::new(|| {
ChainHardforks::new(vec![

View File

@ -1,4 +1,5 @@
use crate::{hardfork, ChainHardforks, ForkCondition, Hardfork};
use alloc::{boxed::Box, format, string::String};
use alloy_chains::Chain;
use alloy_primitives::{uint, U256};
use core::{
@ -9,9 +10,6 @@ use core::{
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
#[cfg(not(feature = "std"))]
use alloc::{boxed::Box, format, string::String};
hardfork!(
/// The name of an Ethereum hardfork.
EthereumHardfork {

View File

@ -1,4 +1,3 @@
#[cfg(not(feature = "std"))]
use alloc::{boxed::Box, format, string::String, vec};
use core::{
any::Any,

View File

@ -15,7 +15,6 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(not(feature = "std"))]
extern crate alloc;
mod display;