Skip to content

Commit

Permalink
Undo macro exports from PR #1917
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dtolnay committed Jan 23, 2021
1 parent 34f4b68 commit b20214d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
29 changes: 13 additions & 16 deletions serde/src/de/value.rs
Expand Up @@ -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> {}
Expand All @@ -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
(
Expand Down Expand Up @@ -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<V>(self, visitor: V) -> $crate::export::Result<V::Value, Self::Error>
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where
V: $crate::de::Visitor<'de>,
V: Visitor<'de>,
{
visitor.$visit(self.value)
}
Expand Down Expand Up @@ -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<V>(self, visitor: V) -> $crate::export::Result<V::Value, Self::Error>
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where
V: $crate::de::Visitor<'de>,
V: Visitor<'de>,
{
visitor.$visit(self.value)
}
Expand Down
2 changes: 1 addition & 1 deletion 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};
Expand Down

0 comments on commit b20214d

Please sign in to comment.