FIX: Use more efficient cloning in IntoIter::clone
Using .extend_from_slice() where possible.
This commit is contained in:
+3
-5
@@ -821,11 +821,9 @@ impl<T, const CAP: usize> Clone for IntoIter<T, CAP>
|
|||||||
where T: Clone,
|
where T: Clone,
|
||||||
{
|
{
|
||||||
fn clone(&self) -> IntoIter<T, CAP> {
|
fn clone(&self) -> IntoIter<T, CAP> {
|
||||||
self.v[self.index..]
|
let mut v = ArrayVec::new();
|
||||||
.iter()
|
v.extend_from_slice(&self.v[self.index..]);
|
||||||
.cloned()
|
v.into_iter()
|
||||||
.collect::<ArrayVec<T, CAP>>()
|
|
||||||
.into_iter()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user