Skip to content

Commit fe96928

Browse files
authored
Auto merge of #34155 - ollie27:unzip, r=alexcrichton
Remove unzip() SizeHint hack 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. Fixes: #33468
2 parents 45cde97 + 02f9be8 commit fe96928

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

src/libcore/iter/iterator.rs

-15
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use clone::Clone;
1212
use cmp::{Ord, PartialOrd, PartialEq, Ordering};
1313
use default::Default;
14-
use marker;
1514
use num::{Zero, One};
1615
use ops::{Add, FnMut, Mul};
1716
use option::Option::{self, Some, None};
@@ -1748,23 +1747,9 @@ pub trait Iterator {
17481747
FromB: Default + Extend<B>,
17491748
Self: Sized + Iterator<Item=(A, B)>,
17501749
{
1751-
struct SizeHint<A>(usize, Option<usize>, marker::PhantomData<A>);
1752-
impl<A> Iterator for SizeHint<A> {
1753-
type Item = A;
1754-
1755-
fn next(&mut self) -> Option<A> { None }
1756-
fn size_hint(&self) -> (usize, Option<usize>) {
1757-
(self.0, self.1)
1758-
}
1759-
}
1760-
1761-
let (lo, hi) = self.size_hint();
17621750
let mut ts: FromA = Default::default();
17631751
let mut us: FromB = Default::default();
17641752

1765-
ts.extend(SizeHint(lo, hi, marker::PhantomData));
1766-
us.extend(SizeHint(lo, hi, marker::PhantomData));
1767-
17681753
for (t, u) in self {
17691754
ts.extend(Some(t));
17701755
us.extend(Some(u));

0 commit comments

Comments
 (0)