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

@ -4,14 +4,12 @@ use crate::{
precompile::{Address, HashSet},
primitives::alloy_primitives::BlockNumber,
};
use alloc::vec::Vec;
use reth_execution_errors::{BlockExecutionError, InternalBlockExecutionError};
use reth_primitives::{Receipt, Receipts, Request, Requests};
use reth_prune_types::{PruneMode, PruneModes, PruneSegmentError, MINIMUM_PRUNING_DISTANCE};
use revm::db::states::bundle_state::BundleRetention;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
/// Takes care of:
/// - recording receipts during execution of multiple blocks.
/// - pruning receipts according to the pruning configuration.
@ -183,14 +181,9 @@ impl BlockBatchRecord {
#[cfg(test)]
mod tests {
use super::*;
use alloc::collections::BTreeMap;
use reth_primitives::{Address, Log, Receipt};
use reth_prune_types::{PruneMode, ReceiptsLogPruneConfig};
#[cfg(feature = "std")]
use std::collections::BTreeMap;
#[cfg(not(feature = "std"))]
extern crate alloc;
#[cfg(not(feature = "std"))]
use alloc::collections::BTreeMap;
#[test]
fn test_save_receipts_empty() {

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;
/// Contains glue code for integrating reth database into revm's [Database].

View File

@ -1,4 +1,5 @@
use crate::precompile::HashMap;
use alloc::vec::Vec;
use reth_primitives::{
keccak256, Account, Address, BlockNumber, Bytecode, Bytes, StorageKey, B256, U256,
};
@ -12,9 +13,6 @@ use reth_trie::{
HashedStorage,
};
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
/// Mock state for testing
#[derive(Debug, Default, Clone, Eq, PartialEq)]
pub struct StateProviderTest {