Skip to content

Commit 6a4c97b

Browse files
committed
remove Clone trait implementation and use #[derive(Clone)]
1 parent 1c975ea commit 6a4c97b

File tree

1 file changed

+4
-35
lines changed

1 file changed

+4
-35
lines changed

src/libcore/slice.rs

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,8 @@ trait SplitIter: DoubleEndedIterator {
11021102

11031103
/// An iterator over subslices separated by elements that match a predicate
11041104
/// function.
1105+
1106+
#[derive(Clone)]
11051107
#[stable(feature = "rust1", since = "1.0.0")]
11061108
pub struct Split<'a, T:'a, P> where P: FnMut(&T) -> bool {
11071109
v: &'a [T],
@@ -1119,17 +1121,6 @@ impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for Split<'a, T, P> where P: FnMut(&T
11191121
}
11201122
}
11211123

1122-
// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
1123-
#[stable(feature = "rust1", since = "1.0.0")]
1124-
impl<'a, T, P> Clone for Split<'a, T, P> where P: Clone + FnMut(&T) -> bool {
1125-
fn clone(&self) -> Split<'a, T, P> {
1126-
Split {
1127-
v: self.v,
1128-
pred: self.pred.clone(),
1129-
finished: self.finished,
1130-
}
1131-
}
1132-
}
11331124

11341125
#[stable(feature = "rust1", since = "1.0.0")]
11351126
impl<'a, T, P> Iterator for Split<'a, T, P> where P: FnMut(&T) -> bool {
@@ -1398,24 +1389,13 @@ forward_iterator! { SplitNMut: T, &'a mut [T] }
13981389
forward_iterator! { RSplitNMut: T, &'a mut [T] }
13991390

14001391
/// An iterator over overlapping subslices of length `size`.
1401-
#[derive(Debug)]
1392+
#[derive(Clone, Debug)]
14021393
#[stable(feature = "rust1", since = "1.0.0")]
14031394
pub struct Windows<'a, T:'a> {
14041395
v: &'a [T],
14051396
size: usize
14061397
}
14071398

1408-
// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
1409-
#[stable(feature = "rust1", since = "1.0.0")]
1410-
impl<'a, T> Clone for Windows<'a, T> {
1411-
fn clone(&self) -> Windows<'a, T> {
1412-
Windows {
1413-
v: self.v,
1414-
size: self.size,
1415-
}
1416-
}
1417-
}
1418-
14191399
#[stable(feature = "rust1", since = "1.0.0")]
14201400
impl<'a, T> Iterator for Windows<'a, T> {
14211401
type Item = &'a [T];
@@ -1492,24 +1472,13 @@ impl<'a, T> ExactSizeIterator for Windows<'a, T> {}
14921472
///
14931473
/// When the slice len is not evenly divided by the chunk size, the last slice
14941474
/// of the iteration will be the remainder.
1495-
#[derive(Debug)]
1475+
#[derive(Clone, Debug)]
14961476
#[stable(feature = "rust1", since = "1.0.0")]
14971477
pub struct Chunks<'a, T:'a> {
14981478
v: &'a [T],
14991479
size: usize
15001480
}
15011481

1502-
// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
1503-
#[stable(feature = "rust1", since = "1.0.0")]
1504-
impl<'a, T> Clone for Chunks<'a, T> {
1505-
fn clone(&self) -> Chunks<'a, T> {
1506-
Chunks {
1507-
v: self.v,
1508-
size: self.size,
1509-
}
1510-
}
1511-
}
1512-
15131482
#[stable(feature = "rust1", since = "1.0.0")]
15141483
impl<'a, T> Iterator for Chunks<'a, T> {
15151484
type Item = &'a [T];

0 commit comments

Comments
 (0)