about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorCharles Gleason <charles_gleason@alumni.brown.edu>2019-10-02 11:29:12 -0400
committerCharles Gleason <charles_gleason@alumni.brown.edu>2019-10-02 11:29:12 -0400
commit5055d4b1c6d7dedaec015e4ba9d96c94b1d978fd (patch)
treed912972597760a13b80251270217619a32c41a03 /src/liballoc
parent7b480cdec6d6c046dc3cd86020f3762e37558cd4 (diff)
downloadrust-5055d4b1c6d7dedaec015e4ba9d96c94b1d978fd.tar.gz
rust-5055d4b1c6d7dedaec015e4ba9d96c94b1d978fd.zip
Use zipped iterators in clone_from for LinkedList
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/collections/linked_list.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/liballoc/collections/linked_list.rs b/src/liballoc/collections/linked_list.rs
index 998bcb87393..702df250999 100644
--- a/src/liballoc/collections/linked_list.rs
+++ b/src/liballoc/collections/linked_list.rs
@@ -1203,8 +1203,8 @@ impl<T: Clone> Clone for LinkedList<T> {
         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());