From add100c20d8d6cac13cbda557572e8f4918f001c Mon Sep 17 00:00:00 2001 From: ass3rt Date: Mon, 25 Apr 2022 09:44:39 -0500 Subject: [PATCH] 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 --- src/blockdata/script.rs | 14 -------------- src/internal_macros.rs | 42 ----------------------------------------- 2 files changed, 56 deletions(-) diff --git a/src/blockdata/script.rs b/src/blockdata/script.rs index 5f995a2686..a1dedb631e 100644 --- a/src/blockdata/script.rs +++ b/src/blockdata/script.rs @@ -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(self, v: &'de str) -> Result - where - E: serde::de::Error, - { - self.visit_str(v) - } - - fn visit_string(self, v: String) -> Result - where - E: serde::de::Error, - { - self.visit_str(&v) - } } deserializer.deserialize_str(Visitor) } else { diff --git a/src/internal_macros.rs b/src/internal_macros.rs index e1bfe7525a..1edaa30e15 100644 --- a/src/internal_macros.rs +++ b/src/internal_macros.rs @@ -152,20 +152,6 @@ macro_rules! serde_string_impl { { $name::from_str(v).map_err(E::custom) } - - fn visit_borrowed_str(self, v: &'de str) -> Result - where - E: $crate::serde::de::Error, - { - self.visit_str(v) - } - - fn visit_string(self, v: $crate::prelude::String) -> Result - where - E: $crate::serde::de::Error, - { - self.visit_str(&v) - } } deserializer.deserialize_str(Visitor) @@ -215,19 +201,6 @@ macro_rules! serde_struct_human_string_impl { $name::from_str(v).map_err(E::custom) } - fn visit_borrowed_str(self, v: &'de str) -> Result - where - E: $crate::serde::de::Error, - { - self.visit_str(v) - } - - fn visit_string(self, v: $crate::prelude::String) -> Result - where - E: $crate::serde::de::Error, - { - self.visit_str(&v) - } } deserializer.deserialize_str(Visitor) @@ -573,21 +546,6 @@ macro_rules! user_enum { Err(E::unknown_variant(v, FIELDS)) } } - - fn visit_borrowed_str(self, v: &'de str) -> Result - where - E: $crate::serde::de::Error, - { - self.visit_str(v) - } - - fn visit_string(self, v: $crate::prelude::String) -> Result - where - E: $crate::serde::de::Error, - { - self.visit_str(&v) - } - } deserializer.deserialize_str(Visitor)