From b20214d4a059e80e80740a8a26035eb9055eff9a Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 23 Jan 2021 12:23:10 -0800 Subject: [PATCH] Undo macro exports from PR #1917 All of these macros are only used internally within the serde crate. There is no need for them to have #[macro_export] and need to be hidden from docs. --- serde/src/de/value.rs | 29 +++++++++++++---------------- serde/src/private/de.rs | 2 +- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/serde/src/de/value.rs b/serde/src/de/value.rs index fcacb0c3..1f878151 100644 --- a/serde/src/de/value.rs +++ b/serde/src/de/value.rs @@ -25,15 +25,13 @@ use lib::*; use self::private::{First, Second}; use __private::de::size_hint; -use de::{self, Expected, IntoDeserializer, SeqAccess}; +use de::{self, Deserializer, Expected, IntoDeserializer, SeqAccess, Visitor}; use ser; //////////////////////////////////////////////////////////////////////////////// -/// For structs that contain a PhantomData. We do not want the trait -/// bound `E: Clone` inferred by derive(Clone). -#[doc(hidden)] -#[macro_export] +// For structs that contain a PhantomData. We do not want the trait +// bound `E: Clone` inferred by derive(Clone). macro_rules! impl_copy_clone { ($ty:ident $(<$lifetime:tt>)*) => { impl<$($lifetime,)* E> Copy for $ty<$($lifetime,)* E> {} @@ -46,9 +44,8 @@ macro_rules! impl_copy_clone { }; } -/// Creates a deserializer any method of which forwards to the specified visitor method -#[doc(hidden)] -#[macro_export(local_inner_macros)] +// Creates a deserializer any method of which forwards to the specified visitor +// method. macro_rules! forward_deserializer { // Non-borrowed references ( @@ -76,15 +73,15 @@ macro_rules! forward_deserializer { impl_copy_clone!($deserializer $(<$lifetime>)*); - impl<'de, $($lifetime,)* E> $crate::de::Deserializer<'de> for $deserializer<$($lifetime,)* E> + impl<'de, $($lifetime,)* E> Deserializer<'de> for $deserializer<$($lifetime,)* E> where - E: $crate::de::Error, + E: de::Error, { type Error = E; - fn deserialize_any(self, visitor: V) -> $crate::export::Result + fn deserialize_any(self, visitor: V) -> Result where - V: $crate::de::Visitor<'de>, + V: Visitor<'de>, { visitor.$visit(self.value) } @@ -120,15 +117,15 @@ macro_rules! forward_deserializer { impl_copy_clone!($deserializer<'de>); - impl<'de, E> $crate::de::Deserializer<'de> for $deserializer<'de, E> + impl<'de, E> Deserializer<'de> for $deserializer<'de, E> where - E: $crate::de::Error, + E: de::Error, { type Error = E; - fn deserialize_any(self, visitor: V) -> $crate::export::Result + fn deserialize_any(self, visitor: V) -> Result where - V: $crate::de::Visitor<'de>, + V: Visitor<'de>, { visitor.$visit(self.value) } diff --git a/serde/src/private/de.rs b/serde/src/private/de.rs index 2432e52e..b0e75af8 100644 --- a/serde/src/private/de.rs +++ b/serde/src/private/de.rs @@ -1,7 +1,7 @@ use lib::*; use de::value::{BorrowedBytesDeserializer, BytesDeserializer}; -use de::{Deserialize, DeserializeSeed, Deserializer, Error, IntoDeserializer, Visitor}; +use de::{self, Deserialize, DeserializeSeed, Deserializer, Error, IntoDeserializer, Visitor}; #[cfg(any(feature = "std", feature = "alloc"))] use de::{MapAccess, Unexpected};