1
Fork 0

Fix clippy::clone_on_copy warnings

This commit is contained in:
Mateusz Mikuła 2019-07-18 14:16:04 +02:00 committed by Mateusz Mikuła
parent 21d5b8bf0c
commit f93032c818
5 changed files with 9 additions and 9 deletions

View file

@ -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;

View file

@ -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);
}
}
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}

View file

@ -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());
}