Skip to content

Commit

Permalink
Removed reimplementations of default methods
Browse files Browse the repository at this point in the history
The default methods do the exact same thing thus our overrides are
useless, potentially even problematic.

Credit to Kixunil for this fix: rust-bitcoin/rust-bitcoin#905 (comment)
  • Loading branch information
ass3rt committed Apr 25, 2022
1 parent 7db03f2 commit add100c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 56 deletions.
14 changes: 0 additions & 14 deletions src/blockdata/script.rs
Expand Up @@ -1024,20 +1024,6 @@ impl<'de> serde::Deserialize<'de> for Script {
let v = Vec::from_hex(v).map_err(E::custom)?;
Ok(Script::from(v))
}

fn visit_borrowed_str<E>(self, v: &'de str) -> Result<Self::Value, E>
where
E: serde::de::Error,
{
self.visit_str(v)
}

fn visit_string<E>(self, v: String) -> Result<Self::Value, E>
where
E: serde::de::Error,
{
self.visit_str(&v)
}
}
deserializer.deserialize_str(Visitor)
} else {
Expand Down
42 changes: 0 additions & 42 deletions src/internal_macros.rs
Expand Up @@ -152,20 +152,6 @@ macro_rules! serde_string_impl {
{
$name::from_str(v).map_err(E::custom)
}

fn visit_borrowed_str<E>(self, v: &'de str) -> Result<Self::Value, E>
where
E: $crate::serde::de::Error,
{
self.visit_str(v)
}

fn visit_string<E>(self, v: $crate::prelude::String) -> Result<Self::Value, E>
where
E: $crate::serde::de::Error,
{
self.visit_str(&v)
}
}

deserializer.deserialize_str(Visitor)
Expand Down Expand Up @@ -215,19 +201,6 @@ macro_rules! serde_struct_human_string_impl {
$name::from_str(v).map_err(E::custom)
}

fn visit_borrowed_str<E>(self, v: &'de str) -> Result<Self::Value, E>
where
E: $crate::serde::de::Error,
{
self.visit_str(v)
}

fn visit_string<E>(self, v: $crate::prelude::String) -> Result<Self::Value, E>
where
E: $crate::serde::de::Error,
{
self.visit_str(&v)
}
}

deserializer.deserialize_str(Visitor)
Expand Down Expand Up @@ -573,21 +546,6 @@ macro_rules! user_enum {
Err(E::unknown_variant(v, FIELDS))
}
}

fn visit_borrowed_str<E>(self, v: &'de str) -> Result<Self::Value, E>
where
E: $crate::serde::de::Error,
{
self.visit_str(v)
}

fn visit_string<E>(self, v: $crate::prelude::String) -> Result<Self::Value, E>
where
E: $crate::serde::de::Error,
{
self.visit_str(&v)
}

}

deserializer.deserialize_str(Visitor)
Expand Down

0 comments on commit add100c

Please sign in to comment.