Remove unneeded impl bounds

This commit is contained in:
David Tolnay 2017-04-14 15:00:16 -07:00
parent 6829c10a10
commit 67d56ae427
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -521,9 +521,8 @@ pub struct SeqDeserializer<I, E> {
impl<I, E> SeqDeserializer<I, E> impl<I, E> SeqDeserializer<I, E>
where where
I: Iterator, I: Iterator,
E: de::Error,
{ {
/// Construct a new `SeqDeserializer<I>`. /// Construct a new `SeqDeserializer<I, E>`.
pub fn new(iter: I) -> Self { pub fn new(iter: I) -> Self {
SeqDeserializer { SeqDeserializer {
iter: iter.fuse(), iter: iter.fuse(),
@ -531,7 +530,13 @@ where
marker: PhantomData, marker: PhantomData,
} }
} }
}
impl<I, E> SeqDeserializer<I, E>
where
I: Iterator,
E: de::Error,
{
/// Check for remaining elements after passing a `SeqDeserializer` to /// Check for remaining elements after passing a `SeqDeserializer` to
/// `Visitor::visit_seq`. /// `Visitor::visit_seq`.
pub fn end(mut self) -> Result<(), E> { pub fn end(mut self) -> Result<(), E> {
@ -694,9 +699,6 @@ pub struct MapDeserializer<'de, I, E>
where where
I: Iterator, I: Iterator,
I::Item: private::Pair, I::Item: private::Pair,
First<I::Item>: IntoDeserializer<'de, E>,
Second<I::Item>: IntoDeserializer<'de, E>,
E: de::Error,
{ {
iter: iter::Fuse<I>, iter: iter::Fuse<I>,
value: Option<Second<I::Item>>, value: Option<Second<I::Item>>,
@ -709,9 +711,6 @@ impl<'de, I, E> MapDeserializer<'de, I, E>
where where
I: Iterator, I: Iterator,
I::Item: private::Pair, I::Item: private::Pair,
First<I::Item>: IntoDeserializer<'de, E>,
Second<I::Item>: IntoDeserializer<'de, E>,
E: de::Error,
{ {
/// Construct a new `MapDeserializer<I, E>`. /// Construct a new `MapDeserializer<I, E>`.
pub fn new(iter: I) -> Self { pub fn new(iter: I) -> Self {
@ -723,7 +722,14 @@ where
error: PhantomData, 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 /// Check for remaining elements after passing a `MapDeserializer` to
/// `Visitor::visit_map`. /// `Visitor::visit_map`.
pub fn end(mut self) -> Result<(), E> { pub fn end(mut self) -> Result<(), E> {
@ -739,7 +745,13 @@ where
Err(de::Error::invalid_length(self.count + remaining, &ExpectedInMap(self.count)),) 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<I::Item>, Second<I::Item>)> { fn next_pair(&mut self) -> Option<(First<I::Item>, Second<I::Item>)> {
match self.iter.next() { match self.iter.next() {
Some(kv) => { Some(kv) => {
@ -884,16 +896,12 @@ where
} }
} }
// Cannot #[derive(Clone)] because of the bound: // Cannot #[derive(Clone)] because of the bound `Second<I::Item>: Clone`.
//
// <I::Item as private::Pair>::Second: Clone
impl<'de, I, E> Clone for MapDeserializer<'de, I, E> impl<'de, I, E> Clone for MapDeserializer<'de, I, E>
where where
I: Iterator + Clone, I: Iterator + Clone,
I::Item: private::Pair, I::Item: private::Pair,
First<I::Item>: IntoDeserializer<'de, E>, Second<I::Item>: Clone,
Second<I::Item>: IntoDeserializer<'de, E> + Clone,
E: de::Error,
{ {
fn clone(&self) -> Self { fn clone(&self) -> Self {
MapDeserializer { MapDeserializer {
@ -906,16 +914,12 @@ where
} }
} }
// Cannot #[derive(Debug)] because of the bound: // Cannot #[derive(Debug)] because of the bound `Second<I::Item>: Debug`.
//
// <I::Item as private::Pair>::Second: Debug
impl<'de, I, E> Debug for MapDeserializer<'de, I, E> impl<'de, I, E> Debug for MapDeserializer<'de, I, E>
where where
I: Iterator + Debug, I: Iterator + Debug,
I::Item: private::Pair, I::Item: private::Pair,
First<I::Item>: IntoDeserializer<'de, E>, Second<I::Item>: Debug,
Second<I::Item>: IntoDeserializer<'de, E> + Debug,
E: de::Error,
{ {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.debug_struct("MapDeserializer") formatter.debug_struct("MapDeserializer")