Skip to content

Commit 5055d4b

Browse files
committed
Use zipped iterators in clone_from for LinkedList
1 parent 7b480cd commit 5055d4b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/liballoc/collections/linked_list.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,8 +1203,8 @@ impl<T: Clone> Clone for LinkedList<T> {
12031203
if self.len() > other.len() {
12041204
self.split_off(other.len());
12051205
}
1206-
for elem in self.iter_mut() {
1207-
elem.clone_from(iter_other.next().unwrap());
1206+
for (elem, elem_other) in self.iter_mut().zip(&mut iter_other) {
1207+
elem.clone_from(elem_other);
12081208
}
12091209
if !iter_other.is_empty() {
12101210
self.extend(iter_other.cloned());

0 commit comments

Comments
 (0)