Skip to content

Commit 51d50f6

Browse files
authored
Chore: some no_std cleanup (bluealloy#1834)
* chore: clean up some std feature usage * chore: clean up some std feature flags and tests in no_std
1 parent dad766d commit 51d50f6

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

crates/bytecode/src/eof/printer.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#[cfg(feature = "std")]
1+
#![cfg(feature = "std")]
2+
23
pub fn print(code: &[u8]) {
34
use crate::{opcode::*, utils::read_i16};
45
use primitives::hex;
@@ -60,7 +61,6 @@ pub fn print(code: &[u8]) {
6061
mod test {
6162
use primitives::hex;
6263

63-
#[cfg(feature = "std")]
6464
#[test]
6565
fn sanity_test() {
6666
super::print(&hex!("6001e200ffff00"));

crates/revm/src/builder.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -463,13 +463,16 @@ where
463463

464464
#[cfg(test)]
465465
mod test {
466+
extern crate alloc;
467+
466468
use crate::{Context, Evm};
469+
use alloc::{boxed::Box, rc::Rc};
467470
use bytecode::Bytecode;
471+
use core::cell::RefCell;
468472
use database::InMemoryDB;
469473
use interpreter::Interpreter;
470474
use primitives::{address, TxKind, U256};
471475
use state::AccountInfo;
472-
use std::{cell::RefCell, rc::Rc};
473476
use wiring::EthereumWiring;
474477

475478
/// Custom evm context

crates/revm/src/handler.rs

+3
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ impl<'a, EvmWiringT: EvmWiring> EvmHandler<'a, EvmWiringT> {
168168

169169
#[cfg(test)]
170170
mod test {
171+
extern crate alloc;
172+
173+
use alloc::boxed::Box;
171174
use core::cell::RefCell;
172175
use database_interface::EmptyDB;
173176
use std::{rc::Rc, sync::Arc};

crates/wiring/src/result.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,13 @@ impl<DBError, TransactionValidationErrorT> EVMError<DBError, TransactionValidati
185185
}
186186
}
187187

188-
#[cfg(feature = "std")]
189-
impl<DBError, TransactionValidationErrorT> std::error::Error
188+
impl<DBError, TransactionValidationErrorT> core::error::Error
190189
for EVMError<DBError, TransactionValidationErrorT>
191190
where
192-
DBError: std::error::Error + 'static,
193-
TransactionValidationErrorT: std::error::Error + 'static,
191+
DBError: core::error::Error + 'static,
192+
TransactionValidationErrorT: core::error::Error + 'static,
194193
{
195-
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
194+
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
196195
match self {
197196
Self::Transaction(e) => Some(e),
198197
Self::Header(e) => Some(e),

0 commit comments

Comments
 (0)