Override Box::<[T]>::clone_from
This commit is contained in:
parent
75b0a68f35
commit
a5734ca417
@ -1090,6 +1090,14 @@ impl<T: Clone> Clone for Box<[T]> {
|
|||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
self.to_vec().into_boxed_slice()
|
self.to_vec().into_boxed_slice()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn clone_from(&mut self, other: &Self) {
|
||||||
|
if self.len() == other.len() {
|
||||||
|
self.clone_from_slice(&other);
|
||||||
|
} else {
|
||||||
|
*self = other.clone();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "box_borrow", since = "1.1.0")]
|
#[stable(feature = "box_borrow", since = "1.1.0")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user