diff --git a/src/liballoc/collections/linked_list.rs b/src/liballoc/collections/linked_list.rs index 998bcb87393b1..702df250999fb 100644 --- a/src/liballoc/collections/linked_list.rs +++ b/src/liballoc/collections/linked_list.rs @@ -1203,8 +1203,8 @@ impl Clone for LinkedList { if self.len() > other.len() { self.split_off(other.len()); } - for elem in self.iter_mut() { - elem.clone_from(iter_other.next().unwrap()); + for (elem, elem_other) in self.iter_mut().zip(&mut iter_other) { + elem.clone_from(elem_other); } if !iter_other.is_empty() { self.extend(iter_other.cloned());