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

@ -9,11 +9,9 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(not(feature = "std"))]
extern crate alloc;
#[cfg(not(feature = "std"))]
use alloc::{boxed::Box, string::String};
use alloc::{boxed::Box, string::String};
use alloy_eips::BlockNumHash;
use alloy_primitives::B256;
use derive_more::Display;

View File

@ -1,13 +1,11 @@
//! Errors when computing the state root.
use alloc::string::ToString;
use alloy_primitives::B256;
use derive_more::Display;
use nybbles::Nibbles;
use reth_storage_errors::{db::DatabaseError, provider::ProviderError};
#[cfg(not(feature = "std"))]
use alloc::string::ToString;
/// State root errors.
#[derive(Display, Debug, PartialEq, Eq, Clone)]
pub enum StateRootError {

View File

@ -1,12 +1,8 @@
//! Contains [Chain], a chain of blocks and their final state.
#[cfg(not(feature = "std"))]
use crate::ExecutionOutcome;
use alloc::{borrow::Cow, collections::BTreeMap};
use core::{fmt, ops::RangeInclusive};
#[cfg(feature = "std")]
use std::{borrow::Cow, collections::BTreeMap};
use crate::ExecutionOutcome;
use reth_execution_errors::{BlockExecutionError, InternalBlockExecutionError};
use reth_primitives::{
Address, BlockHash, BlockNumHash, BlockNumber, ForkBlock, Receipt, SealedBlock,

View File

@ -8,7 +8,6 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#[cfg(not(feature = "std"))]
extern crate alloc;
mod chain;

View File

@ -1,8 +1,6 @@
//! Builder for creating an EVM with a database and environment.
#[cfg(not(feature = "std"))]
use alloc::boxed::Box;
use revm::{inspector_handle_register, Database, Evm, EvmBuilder, GetInspector};
use revm_primitives::EnvWithHandlerCfg;

View File

@ -9,7 +9,6 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(not(feature = "std"))]
extern crate alloc;
use core::ops::Deref;

View File

@ -1,12 +1,7 @@
//! System contract call functions.
#[cfg(feature = "std")]
use std::fmt::Display;
#[cfg(not(feature = "std"))]
use {
alloc::{boxed::Box, format, string::ToString, vec::Vec},
core::fmt::Display,
};
use alloc::{boxed::Box, format, string::ToString, vec::Vec};
use core::fmt::Display;
use crate::ConfigureEvm;
use alloy_eips::{