Skip to content

Commit e11d01f

Browse files
committed
Remove constructors for FlatMapAccess and FlatStructAccess
They are used only in one place each, so for simplifying understanding it is better to inline them
1 parent a901f50 commit e11d01f

File tree

1 file changed

+11
-30
lines changed

1 file changed

+11
-30
lines changed

serde/src/private/de.rs

+11-30
Original file line numberDiff line numberDiff line change
@@ -2775,7 +2775,11 @@ where
27752775
where
27762776
V: Visitor<'de>,
27772777
{
2778-
visitor.visit_map(FlatMapAccess::new(self.0.iter()))
2778+
visitor.visit_map(FlatMapAccess {
2779+
iter: self.0.iter(),
2780+
pending_content: None,
2781+
_marker: PhantomData,
2782+
})
27792783
}
27802784

27812785
fn deserialize_struct<V>(
@@ -2787,7 +2791,12 @@ where
27872791
where
27882792
V: Visitor<'de>,
27892793
{
2790-
visitor.visit_map(FlatStructAccess::new(self.0.iter_mut(), fields))
2794+
visitor.visit_map(FlatStructAccess {
2795+
iter: self.0.iter_mut(),
2796+
pending_content: None,
2797+
fields: fields,
2798+
_marker: PhantomData,
2799+
})
27912800
}
27922801

27932802
fn deserialize_newtype_struct<V>(self, _name: &str, visitor: V) -> Result<V::Value, Self::Error>
@@ -2847,19 +2856,6 @@ struct FlatMapAccess<'a, 'de: 'a, E> {
28472856
_marker: PhantomData<E>,
28482857
}
28492858

2850-
#[cfg(any(feature = "std", feature = "alloc"))]
2851-
impl<'a, 'de, E> FlatMapAccess<'a, 'de, E> {
2852-
fn new(
2853-
iter: slice::Iter<'a, Option<(Content<'de>, Content<'de>)>>,
2854-
) -> FlatMapAccess<'a, 'de, E> {
2855-
FlatMapAccess {
2856-
iter: iter,
2857-
pending_content: None,
2858-
_marker: PhantomData,
2859-
}
2860-
}
2861-
}
2862-
28632859
#[cfg(any(feature = "std", feature = "alloc"))]
28642860
impl<'a, 'de, E> MapAccess<'de> for FlatMapAccess<'a, 'de, E>
28652861
where
@@ -2904,21 +2900,6 @@ struct FlatStructAccess<'a, 'de: 'a, E> {
29042900
_marker: PhantomData<E>,
29052901
}
29062902

2907-
#[cfg(any(feature = "std", feature = "alloc"))]
2908-
impl<'a, 'de, E> FlatStructAccess<'a, 'de, E> {
2909-
fn new(
2910-
iter: slice::IterMut<'a, Option<(Content<'de>, Content<'de>)>>,
2911-
fields: &'static [&'static str],
2912-
) -> FlatStructAccess<'a, 'de, E> {
2913-
FlatStructAccess {
2914-
iter: iter,
2915-
pending_content: None,
2916-
fields: fields,
2917-
_marker: PhantomData,
2918-
}
2919-
}
2920-
}
2921-
29222903
#[cfg(any(feature = "std", feature = "alloc"))]
29232904
impl<'a, 'de, E> MapAccess<'de> for FlatStructAccess<'a, 'de, E>
29242905
where

0 commit comments

Comments
 (0)