Skip to content

Commit

Permalink
chore: improve FromStr for BlockNumberOrTag to be case-insensitive (#…
Browse files Browse the repository at this point in the history
…1891)

chore: improve FromStr for `BlockNumberOrTag`
  • Loading branch information
yjhmelody authored Jan 6, 2025
1 parent 6a7e3eb commit 69f7631
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/eips/src/eip1898.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl<'de> serde::Deserialize<'de> for BlockNumberOrTag {
where
D: serde::Deserializer<'de>,
{
let s = alloc::string::String::deserialize(deserializer)?.to_lowercase();
let s = alloc::string::String::deserialize(deserializer)?;
s.parse().map_err(serde::de::Error::custom)
}
}
Expand All @@ -196,7 +196,7 @@ impl FromStr for BlockNumberOrTag {
type Err = ParseBlockNumberError;

fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(match s {
Ok(match s.to_lowercase().as_str() {
"latest" => Self::Latest,
"finalized" => Self::Finalized,
"safe" => Self::Safe,
Expand Down

0 comments on commit 69f7631

Please sign in to comment.