Skip to content

Commit 8779be3

Browse files
committed
implement Clone for slices
1 parent 60ed659 commit 8779be3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/libstd/clone.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,18 @@ impl<'self, T> Clone for &'self T {
5656
fn clone(&self) -> &'self T { *self }
5757
}
5858

59+
impl<'self, T> Clone for &'self [T] {
60+
/// Return a shallow copy of the slice.
61+
#[inline]
62+
fn clone(&self) -> &'self [T] { *self }
63+
}
64+
65+
impl<'self> Clone for &'self str {
66+
/// Return a shallow copy of the slice.
67+
#[inline]
68+
fn clone(&self) -> &'self str { *self }
69+
}
70+
5971
macro_rules! clone_impl(
6072
($t:ty) => {
6173
impl Clone for $t {

0 commit comments

Comments
 (0)