Skip to content

Commit dbc114f

Browse files
committed
Avoid closures in the Copied implementation
1 parent 97cc314 commit dbc114f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/iter/copied.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ where
102102
T: 'a + Copy,
103103
{
104104
type Item = T;
105-
type IntoIter = iter::Map<P::IntoIter, fn(&T) -> T>;
105+
type IntoIter = iter::Cloned<P::IntoIter>;
106106

107107
fn into_iter(self) -> Self::IntoIter {
108108
// FIXME: use `Iterator::copied()` when Rust 1.36 is our minimum.
109-
self.base.into_iter().map(|&x| x)
109+
self.base.into_iter().cloned()
110110
}
111111

112112
fn min_len(&self) -> usize {
@@ -211,7 +211,7 @@ where
211211
I: IntoIterator<Item = &'a T>,
212212
{
213213
// FIXME: use `Iterator::copied()` when Rust 1.36 is our minimum.
214-
self.base = self.base.consume_iter(iter.into_iter().map(|&x| x));
214+
self.base = self.base.consume_iter(iter.into_iter().cloned());
215215
self
216216
}
217217

0 commit comments

Comments
 (0)