Skip to content

Commit

Permalink
Remove unzip() SizeHint hack
Browse files Browse the repository at this point in the history
This was using an invalid iterator so is likely to end with buggy
behaviour.

It also doesn't even benefit many type in std including Vec so removing it
shouldn't cause any problems.
  • Loading branch information
ollie27 committed Jun 7, 2016
1 parent 763f923 commit 02f9be8
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/libcore/iter/iterator.rs
Expand Up @@ -11,7 +11,6 @@
use clone::Clone;
use cmp::{Ord, PartialOrd, PartialEq, Ordering};
use default::Default;
use marker;
use num::{Zero, One};
use ops::{Add, FnMut, Mul};
use option::Option::{self, Some, None};
Expand Down Expand Up @@ -1747,23 +1746,9 @@ pub trait Iterator {
FromB: Default + Extend<B>,
Self: Sized + Iterator<Item=(A, B)>,
{
struct SizeHint<A>(usize, Option<usize>, marker::PhantomData<A>);
impl<A> Iterator for SizeHint<A> {
type Item = A;

fn next(&mut self) -> Option<A> { None }
fn size_hint(&self) -> (usize, Option<usize>) {
(self.0, self.1)
}
}

let (lo, hi) = self.size_hint();
let mut ts: FromA = Default::default();
let mut us: FromB = Default::default();

ts.extend(SizeHint(lo, hi, marker::PhantomData));
us.extend(SizeHint(lo, hi, marker::PhantomData));

for (t, u) in self {
ts.extend(Some(t));
us.extend(Some(u));
Expand Down

0 comments on commit 02f9be8

Please sign in to comment.