From 67d56ae42765379cb6b0301885c33d9917f9feb4 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 14 Apr 2017 15:00:16 -0700 Subject: [PATCH] Remove unneeded impl bounds --- serde/src/de/value.rs | 44 +++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/serde/src/de/value.rs b/serde/src/de/value.rs index 77b97d99..29c8bcdb 100644 --- a/serde/src/de/value.rs +++ b/serde/src/de/value.rs @@ -521,9 +521,8 @@ pub struct SeqDeserializer { impl SeqDeserializer where I: Iterator, - E: de::Error, { - /// Construct a new `SeqDeserializer`. + /// Construct a new `SeqDeserializer`. pub fn new(iter: I) -> Self { SeqDeserializer { iter: iter.fuse(), @@ -531,7 +530,13 @@ where marker: PhantomData, } } +} +impl SeqDeserializer +where + I: Iterator, + E: de::Error, +{ /// Check for remaining elements after passing a `SeqDeserializer` to /// `Visitor::visit_seq`. pub fn end(mut self) -> Result<(), E> { @@ -694,9 +699,6 @@ pub struct MapDeserializer<'de, I, E> where I: Iterator, I::Item: private::Pair, - First: IntoDeserializer<'de, E>, - Second: IntoDeserializer<'de, E>, - E: de::Error, { iter: iter::Fuse, value: Option>, @@ -709,9 +711,6 @@ impl<'de, I, E> MapDeserializer<'de, I, E> where I: Iterator, I::Item: private::Pair, - First: IntoDeserializer<'de, E>, - Second: IntoDeserializer<'de, E>, - E: de::Error, { /// Construct a new `MapDeserializer`. pub fn new(iter: I) -> Self { @@ -723,7 +722,14 @@ where error: PhantomData, } } +} +impl<'de, I, E> MapDeserializer<'de, I, E> +where + I: Iterator, + I::Item: private::Pair, + E: de::Error, +{ /// Check for remaining elements after passing a `MapDeserializer` to /// `Visitor::visit_map`. pub fn end(mut self) -> Result<(), E> { @@ -739,7 +745,13 @@ where Err(de::Error::invalid_length(self.count + remaining, &ExpectedInMap(self.count)),) } } +} +impl<'de, I, E> MapDeserializer<'de, I, E> +where + I: Iterator, + I::Item: private::Pair, +{ fn next_pair(&mut self) -> Option<(First, Second)> { match self.iter.next() { Some(kv) => { @@ -884,16 +896,12 @@ where } } -// Cannot #[derive(Clone)] because of the bound: -// -// ::Second: Clone +// Cannot #[derive(Clone)] because of the bound `Second: Clone`. impl<'de, I, E> Clone for MapDeserializer<'de, I, E> where I: Iterator + Clone, I::Item: private::Pair, - First: IntoDeserializer<'de, E>, - Second: IntoDeserializer<'de, E> + Clone, - E: de::Error, + Second: Clone, { fn clone(&self) -> Self { MapDeserializer { @@ -906,16 +914,12 @@ where } } -// Cannot #[derive(Debug)] because of the bound: -// -// ::Second: Debug +// Cannot #[derive(Debug)] because of the bound `Second: Debug`. impl<'de, I, E> Debug for MapDeserializer<'de, I, E> where I: Iterator + Debug, I::Item: private::Pair, - First: IntoDeserializer<'de, E>, - Second: IntoDeserializer<'de, E> + Debug, - E: de::Error, + Second: Debug, { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { formatter.debug_struct("MapDeserializer")