Removed reimplementations of default methods

The default methods do the exact same thing thus our overrides are
useless, potentially even problematic.

Credit to Kixunil for this fix: https://github.com/rust-bitcoin/rust-bitcoin/pull/905#issuecomment-1092756343
This commit is contained in:
ass3rt 2022-04-25 09:44:39 -05:00
parent 7db03f27e4
commit add100c20d
2 changed files with 0 additions and 56 deletions

View File

@ -1024,20 +1024,6 @@ impl<'de> serde::Deserialize<'de> for Script {
let v = Vec::from_hex(v).map_err(E::custom)?; let v = Vec::from_hex(v).map_err(E::custom)?;
Ok(Script::from(v)) 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) deserializer.deserialize_str(Visitor)
} else { } else {

View File

@ -152,20 +152,6 @@ macro_rules! serde_string_impl {
{ {
$name::from_str(v).map_err(E::custom) $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) deserializer.deserialize_str(Visitor)
@ -215,19 +201,6 @@ macro_rules! serde_struct_human_string_impl {
$name::from_str(v).map_err(E::custom) $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) deserializer.deserialize_str(Visitor)
@ -573,21 +546,6 @@ macro_rules! user_enum {
Err(E::unknown_variant(v, FIELDS)) 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) deserializer.deserialize_str(Visitor)