We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 702b45e commit 7b480cdCopy full SHA for 7b480cd
src/liballoc/collections/linked_list.rs
@@ -1197,6 +1197,19 @@ impl<T: Clone> Clone for LinkedList<T> {
1197
fn clone(&self) -> Self {
1198
self.iter().cloned().collect()
1199
}
1200
+
1201
+ fn clone_from(&mut self, other: &Self) {
1202
+ let mut iter_other = other.iter();
1203
+ if self.len() > other.len() {
1204
+ self.split_off(other.len());
1205
+ }
1206
+ for elem in self.iter_mut() {
1207
+ elem.clone_from(iter_other.next().unwrap());
1208
1209
+ if !iter_other.is_empty() {
1210
+ self.extend(iter_other.cloned());
1211
1212
1213
1214
1215
#[stable(feature = "rust1", since = "1.0.0")]
0 commit comments