Skip to content

Commit

Permalink
chore(workspace): Allow stdlib in cfg(test) (#548)
Browse files Browse the repository at this point in the history
* chore(workspace): Allow stdlib in `cfg(test)`

* rebase

* rebase
  • Loading branch information
clabby authored Sep 21, 2024
1 parent d61fd23 commit 6830edb
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 17 deletions.
2 changes: 0 additions & 2 deletions crates/common/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ pub fn exit(code: usize) -> ! {

#[cfg(not(any(target_arch = "mips", target_arch = "riscv64", target_os = "zkvm")))]
mod native_io {
extern crate std;

use crate::{
errors::{IOError, IOResult},
io::FileDescriptor,
Expand Down
2 changes: 1 addition & 1 deletion crates/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![deny(unused_must_use, rust_2018_idioms)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![cfg_attr(target_arch = "mips", feature(asm_experimental_arch))]
#![no_std]
#![cfg_attr(any(target_arch = "mips", target_arch = "riscv64", target_os = "zkvm"), no_std)]

extern crate alloc;

Expand Down
6 changes: 2 additions & 4 deletions crates/executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![deny(unused_must_use, rust_2018_idioms)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![no_std]
#![cfg_attr(not(test), no_std)]

extern crate alloc;

Expand Down Expand Up @@ -646,8 +646,6 @@ where

#[cfg(test)]
mod test {
extern crate std;

use super::*;
use alloy_primitives::{address, b256, hex};
use alloy_rlp::Decodable;
Expand All @@ -656,7 +654,7 @@ mod test {
use kona_mpt::NoopTrieHinter;
use op_alloy_genesis::{OP_BASE_FEE_PARAMS, OP_CANYON_BASE_FEE_PARAMS};
use serde::Deserialize;
use std::{collections::HashMap, format};
use std::collections::HashMap;

/// A [TrieProvider] implementation that fetches trie nodes and bytecode from the local
/// testdata folder.
Expand Down
2 changes: 1 addition & 1 deletion crates/mpt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![deny(unused_must_use, rust_2018_idioms)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![no_std]
#![cfg_attr(not(test), no_std)]

extern crate alloc;

Expand Down
2 changes: 0 additions & 2 deletions crates/mpt/src/test_util.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Testing utilities for `kona-mpt`

extern crate std;

use crate::{ordered_trie_with_encoder, TrieProvider};
use alloc::{collections::BTreeMap, vec::Vec};
use alloy_consensus::{Receipt, ReceiptEnvelope, ReceiptWithBloom, TxEnvelope, TxType};
Expand Down
2 changes: 0 additions & 2 deletions crates/preimage/src/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ impl HintReaderServer for HintReader {

#[cfg(test)]
mod test {
extern crate std;

use super::*;
use crate::test_utils::bidirectional_pipe;
use alloc::{string::ToString, sync::Arc, vec::Vec};
Expand Down
2 changes: 1 addition & 1 deletion crates/preimage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![deny(unused_must_use, rust_2018_idioms)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![no_std]
#![cfg_attr(not(test), no_std)]

extern crate alloc;

Expand Down
2 changes: 0 additions & 2 deletions crates/preimage/src/oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ impl PreimageOracleServer for OracleServer {

#[cfg(test)]
mod test {
extern crate std;

use super::*;
use crate::{test_utils::bidirectional_pipe, PreimageKeyType};
use alloc::sync::Arc;
Expand Down
2 changes: 0 additions & 2 deletions crates/preimage/src/test_utils.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Test utilities for the `kona-preimage` crate.

extern crate std;

use os_pipe::{PipeReader, PipeWriter};
use std::io::Result;

Expand Down

0 comments on commit 6830edb

Please sign in to comment.