Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support no_std for alloy-genesis/alloy-serde #320

Merged
merged 12 commits into from
Mar 21, 2024
1 change: 1 addition & 0 deletions crates/serde/src/json_u256.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Json U256 serde helpers.

#[allow(unused_imports)]
Copy link
Contributor Author

@yjhmelody yjhmelody Mar 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems the clippy warnings are not correct, for no_std must import String/ToString.
If not imports them, cargo test -p alloy-serde --no-default-features will fail.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can feature gate these imports instead:

see also

https://github.com/alloy-rs/alloy/blob/main/crates/eips/src/eip2930.rs#L7-L8

use alloc::{fmt, format, string::String};
use core::str::FromStr;

Expand Down
1 change: 1 addition & 0 deletions crates/serde/src/num.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Numeric serde helpers.

#[allow(unused_imports)]
use alloc::{str::FromStr, string::ToString};

use alloy_primitives::{U256, U64};
Expand Down
1 change: 1 addition & 0 deletions crates/serde/src/storage.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[allow(unused_imports)]
use alloc::{
collections::BTreeMap,
fmt::Write,
Expand Down
Loading