Skip to content

Commit

Permalink
feat(serde): remove deprecated num module (alloy-rs#1350)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Sep 24, 2024
1 parent ec30a65 commit 0610864
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 361 deletions.
2 changes: 1 addition & 1 deletion crates/rpc-types-eth/src/fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub struct FeeHistory {
serde(
default,
skip_serializing_if = "Option::is_none",
with = "alloy_serde::u128_vec_vec_opt_via_ruint"
with = "alloy_serde::quantity::u128_vec_vec_opt"
)
)]
pub reward: Option<Vec<Vec<u128>>>,
Expand Down
5 changes: 0 additions & 5 deletions crates/serde/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ pub use self::bool::*;
mod optional;
pub use self::optional::*;

#[cfg_attr(not(test), deprecated = "use `quantity::{self, opt, vec}` instead")]
pub mod num;
#[allow(deprecated)]
pub use num::*;

pub mod quantity;

/// Storage related helpers.
Expand Down
307 changes: 0 additions & 307 deletions crates/serde/src/num.rs

This file was deleted.

4 changes: 2 additions & 2 deletions crates/serde/src/optional.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Serde functions for encoding optional values.
use serde::{Deserialize, Deserializer};

/// For use with serde's `deserialize_with` on a sequence that must be
Expand All @@ -8,6 +9,5 @@ where
T: Deserialize<'de> + Default,
D: Deserializer<'de>,
{
let s: Option<T> = Deserialize::deserialize(deserializer)?;
Ok(s.unwrap_or_default())
Option::<T>::deserialize(deserializer).map(Option::unwrap_or_default)
}
Loading

0 comments on commit 0610864

Please sign in to comment.