diff options
| author | Mateusz Mikuła <matti@marinelayer.io> | 2019-07-18 14:16:04 +0200 |
|---|---|---|
| committer | Mateusz Mikuła <mati865@gmail.com> | 2019-07-18 15:14:56 +0200 |
| commit | f93032c818da6482777e6fa35a535a494241a0f1 (patch) | |
| tree | 14411ae51c1cab536393b68cdaf41b4ae62cea7d | |
| parent | 21d5b8bf0c26e3ee4c270ce5527df66b1af56513 (diff) | |
| download | rust-f93032c818da6482777e6fa35a535a494241a0f1.tar.gz rust-f93032c818da6482777e6fa35a535a494241a0f1.zip | |
Fix clippy::clone_on_copy warnings
| -rw-r--r-- | src/liballoc/collections/linked_list.rs | 8 | ||||
| -rw-r--r-- | src/liballoc/rc.rs | 2 | ||||
| -rw-r--r-- | src/liballoc/sync.rs | 2 | ||||
| -rw-r--r-- | src/libcore/alloc.rs | 4 | ||||
| -rw-r--r-- | src/libstd/sys/unix/alloc.rs | 2 |
5 files changed, 9 insertions, 9 deletions
diff --git a/src/liballoc/collections/linked_list.rs b/src/liballoc/collections/linked_list.rs index db0d6e2f9b9..bbb96725ea0 100644 --- a/src/liballoc/collections/linked_list.rs +++ b/src/liballoc/collections/linked_list.rs @@ -237,15 +237,15 @@ impl<T> LinkedList<T> { // Not creating new mutable (unique!) references overlapping `element`. match node.prev { - Some(prev) => (*prev.as_ptr()).next = node.next.clone(), + Some(prev) => (*prev.as_ptr()).next = node.next, // this node is the head node - None => self.head = node.next.clone(), + None => self.head = node.next, }; match node.next { - Some(next) => (*next.as_ptr()).prev = node.prev.clone(), + Some(next) => (*next.as_ptr()).prev = node.prev, // this node is the tail node - None => self.tail = node.prev.clone(), + None => self.tail = node.prev, }; self.len -= 1; diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 36d54656795..0d0ff7c16f1 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -815,7 +815,7 @@ impl<T> Rc<[T]> { let slice = from_raw_parts_mut(self.elems, self.n_elems); ptr::drop_in_place(slice); - Global.dealloc(self.mem, self.layout.clone()); + Global.dealloc(self.mem, self.layout); } } } diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index 7cb826ee024..93aff733724 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -703,7 +703,7 @@ impl<T> Arc<[T]> { let slice = from_raw_parts_mut(self.elems, self.n_elems); ptr::drop_in_place(slice); - Global.dealloc(self.mem.cast(), self.layout.clone()); + Global.dealloc(self.mem.cast(), self.layout); } } } diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs index 487f3b76fc7..5d0333d5226 100644 --- a/src/libcore/alloc.rs +++ b/src/libcore/alloc.rs @@ -827,11 +827,11 @@ pub unsafe trait Alloc { let old_size = layout.size(); if new_size >= old_size { - if let Ok(()) = self.grow_in_place(ptr, layout.clone(), new_size) { + if let Ok(()) = self.grow_in_place(ptr, layout, new_size) { return Ok(ptr); } } else if new_size < old_size { - if let Ok(()) = self.shrink_in_place(ptr, layout.clone(), new_size) { + if let Ok(()) = self.shrink_in_place(ptr, layout, new_size) { return Ok(ptr); } } diff --git a/src/libstd/sys/unix/alloc.rs b/src/libstd/sys/unix/alloc.rs index 2c2dd3b77ea..f47dc92d2de 100644 --- a/src/libstd/sys/unix/alloc.rs +++ b/src/libstd/sys/unix/alloc.rs @@ -29,7 +29,7 @@ unsafe impl GlobalAlloc for System { if layout.align() <= MIN_ALIGN && layout.align() <= layout.size() { libc::calloc(layout.size(), 1) as *mut u8 } else { - let ptr = self.alloc(layout.clone()); + let ptr = self.alloc(layout); if !ptr.is_null() { ptr::write_bytes(ptr, 0, layout.size()); } |
