diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index fe477c3495f8..3bc5b0ca053e 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -708,7 +708,7 @@ mod tests { let iterout = vec![3, 5, 9]; let pq = BinaryHeap::from_vec(data); - let v: Vec<_> = pq.iter().rev().map(|&x| x).collect(); + let v: Vec<_> = pq.iter().rev().cloned().collect(); assert_eq!(v, iterout); } diff --git a/src/libcollections/ring_buf.rs b/src/libcollections/ring_buf.rs index 85c4a64c0c17..8c219418309b 100644 --- a/src/libcollections/ring_buf.rs +++ b/src/libcollections/ring_buf.rs @@ -529,13 +529,13 @@ impl RingBuf { /// assert_eq!(&buf.iter_mut().collect::>()[], b); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - pub fn iter_mut<'a>(&'a mut self) -> IterMut<'a, T> { + pub fn iter_mut(&mut self) -> IterMut { IterMut { tail: self.tail, head: self.head, cap: self.cap, ptr: self.ptr, - marker: marker::ContravariantLifetime::<'a>, + marker: marker::ContravariantLifetime, } } @@ -552,7 +552,7 @@ impl RingBuf { #[inline] #[unstable(feature = "collections", reason = "matches collection reform specification, waiting for dust to settle")] - pub fn as_slices<'a>(&'a self) -> (&'a [T], &'a [T]) { + pub fn as_slices(&self) -> (&[T], &[T]) { unsafe { let contiguous = self.is_contiguous(); let buf = self.buffer_as_slice(); @@ -572,7 +572,7 @@ impl RingBuf { #[inline] #[unstable(feature = "collections", reason = "matches collection reform specification, waiting for dust to settle")] - pub fn as_mut_slices<'a>(&'a mut self) -> (&'a mut [T], &'a mut [T]) { + pub fn as_mut_slices(&mut self) -> (&mut [T], &mut [T]) { unsafe { let contiguous = self.is_contiguous(); let head = self.head; @@ -1584,7 +1584,7 @@ impl Index for RingBuf { type Output = A; #[inline] - fn index<'a>(&'a self, i: &usize) -> &'a A { + fn index(&self, i: &usize) -> &A { self.get(*i).expect("Out of bounds access") } } @@ -1594,7 +1594,7 @@ impl IndexMut for RingBuf { type Output = A; #[inline] - fn index_mut<'a>(&'a mut self, i: &usize) -> &'a mut A { + fn index_mut(&mut self, i: &usize) -> &mut A { self.get_mut(*i).expect("Out of bounds access") } } diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 3fe3fe04a543..eb7e1b10c9b2 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -812,27 +812,27 @@ impl SliceExt for [T] { } #[inline] - fn slice<'a>(&'a self, start: usize, end: usize) -> &'a [T] { + fn slice(&self, start: usize, end: usize) -> &[T] { &self[start .. end] } #[inline] - fn slice_from<'a>(&'a self, start: usize) -> &'a [T] { + fn slice_from(&self, start: usize) -> &[T] { &self[start ..] } #[inline] - fn slice_to<'a>(&'a self, end: usize) -> &'a [T] { + fn slice_to(&self, end: usize) -> &[T] { &self[.. end] } #[inline] - fn split_at<'a>(&'a self, mid: usize) -> (&'a [T], &'a [T]) { + fn split_at(&self, mid: usize) -> (&[T], &[T]) { core_slice::SliceExt::split_at(self, mid) } #[inline] - fn iter<'a>(&'a self) -> Iter<'a, T> { + fn iter(&self) -> Iter { core_slice::SliceExt::iter(self) } @@ -855,42 +855,42 @@ impl SliceExt for [T] { } #[inline] - fn windows<'a>(&'a self, size: usize) -> Windows<'a, T> { + fn windows(&self, size: usize) -> Windows { core_slice::SliceExt::windows(self, size) } #[inline] - fn chunks<'a>(&'a self, size: usize) -> Chunks<'a, T> { + fn chunks(&self, size: usize) -> Chunks { core_slice::SliceExt::chunks(self, size) } #[inline] - fn get<'a>(&'a self, index: usize) -> Option<&'a T> { + fn get(&self, index: usize) -> Option<&T> { core_slice::SliceExt::get(self, index) } #[inline] - fn first<'a>(&'a self) -> Option<&'a T> { + fn first(&self) -> Option<&T> { core_slice::SliceExt::first(self) } #[inline] - fn tail<'a>(&'a self) -> &'a [T] { + fn tail(&self) -> &[T] { core_slice::SliceExt::tail(self) } #[inline] - fn init<'a>(&'a self) -> &'a [T] { + fn init(&self) -> &[T] { core_slice::SliceExt::init(self) } #[inline] - fn last<'a>(&'a self) -> Option<&'a T> { + fn last(&self) -> Option<&T> { core_slice::SliceExt::last(self) } #[inline] - unsafe fn get_unchecked<'a>(&'a self, index: usize) -> &'a T { + unsafe fn get_unchecked(&self, index: usize) -> &T { core_slice::SliceExt::get_unchecked(self, index) } @@ -916,52 +916,52 @@ impl SliceExt for [T] { } #[inline] - fn get_mut<'a>(&'a mut self, index: usize) -> Option<&'a mut T> { + fn get_mut(&mut self, index: usize) -> Option<&mut T> { core_slice::SliceExt::get_mut(self, index) } #[inline] - fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] { + fn as_mut_slice(&mut self) -> &mut [T] { core_slice::SliceExt::as_mut_slice(self) } #[inline] - fn slice_mut<'a>(&'a mut self, start: usize, end: usize) -> &'a mut [T] { + fn slice_mut(&mut self, start: usize, end: usize) -> &mut [T] { &mut self[start .. end] } #[inline] - fn slice_from_mut<'a>(&'a mut self, start: usize) -> &'a mut [T] { + fn slice_from_mut(&mut self, start: usize) -> &mut [T] { &mut self[start ..] } #[inline] - fn slice_to_mut<'a>(&'a mut self, end: usize) -> &'a mut [T] { + fn slice_to_mut(&mut self, end: usize) -> &mut [T] { &mut self[.. end] } #[inline] - fn iter_mut<'a>(&'a mut self) -> IterMut<'a, T> { + fn iter_mut(&mut self) -> IterMut { core_slice::SliceExt::iter_mut(self) } #[inline] - fn first_mut<'a>(&'a mut self) -> Option<&'a mut T> { + fn first_mut(&mut self) -> Option<&mut T> { core_slice::SliceExt::first_mut(self) } #[inline] - fn tail_mut<'a>(&'a mut self) -> &'a mut [T] { + fn tail_mut(&mut self) -> &mut [T] { core_slice::SliceExt::tail_mut(self) } #[inline] - fn init_mut<'a>(&'a mut self) -> &'a mut [T] { + fn init_mut(&mut self) -> &mut [T] { core_slice::SliceExt::init_mut(self) } #[inline] - fn last_mut<'a>(&'a mut self) -> Option<&'a mut T> { + fn last_mut(&mut self) -> Option<&mut T> { core_slice::SliceExt::last_mut(self) } @@ -984,7 +984,7 @@ impl SliceExt for [T] { } #[inline] - fn chunks_mut<'a>(&'a mut self, chunk_size: usize) -> ChunksMut<'a, T> { + fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut { core_slice::SliceExt::chunks_mut(self, chunk_size) } @@ -994,7 +994,7 @@ impl SliceExt for [T] { } #[inline] - fn split_at_mut<'a>(&'a mut self, mid: usize) -> (&'a mut [T], &'a mut [T]) { + fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T]) { core_slice::SliceExt::split_at_mut(self, mid) } @@ -1004,7 +1004,7 @@ impl SliceExt for [T] { } #[inline] - unsafe fn get_unchecked_mut<'a>(&'a mut self, index: usize) -> &'a mut T { + unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut T { core_slice::SliceExt::get_unchecked_mut(self, index) } diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index e6fb3005ff38..65c397359f4e 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -464,7 +464,7 @@ pub trait StrExt: Index { #[inline] #[unstable(feature = "collections", reason = "this functionality may be moved to libunicode")] - fn nfd_chars<'a>(&'a self) -> Decompositions<'a> { + fn nfd_chars(&self) -> Decompositions { Decompositions { iter: self[].chars(), buffer: Vec::new(), @@ -478,7 +478,7 @@ pub trait StrExt: Index { #[inline] #[unstable(feature = "collections", reason = "this functionality may be moved to libunicode")] - fn nfkd_chars<'a>(&'a self) -> Decompositions<'a> { + fn nfkd_chars(&self) -> Decompositions { Decompositions { iter: self[].chars(), buffer: Vec::new(), @@ -492,7 +492,7 @@ pub trait StrExt: Index { #[inline] #[unstable(feature = "collections", reason = "this functionality may be moved to libunicode")] - fn nfc_chars<'a>(&'a self) -> Recompositions<'a> { + fn nfc_chars(&self) -> Recompositions { Recompositions { iter: self.nfd_chars(), state: Composing, @@ -507,7 +507,7 @@ pub trait StrExt: Index { #[inline] #[unstable(feature = "collections", reason = "this functionality may be moved to libunicode")] - fn nfkc_chars<'a>(&'a self) -> Recompositions<'a> { + fn nfkc_chars(&self) -> Recompositions { Recompositions { iter: self.nfkd_chars(), state: Composing, diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index e3db8d04d4ab..cf2d4415412a 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -488,7 +488,7 @@ impl String { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn as_bytes<'a>(&'a self) -> &'a [u8] { + pub fn as_bytes(&self) -> &[u8] { &self.vec } @@ -627,7 +627,7 @@ impl String { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub unsafe fn as_mut_vec<'a>(&'a mut self) -> &'a mut Vec { + pub unsafe fn as_mut_vec(&mut self) -> &mut Vec { &mut self.vec } @@ -803,7 +803,7 @@ impl<'a, 'b> PartialEq> for &'b str { impl Str for String { #[inline] #[stable(feature = "rust1", since = "1.0.0")] - fn as_slice<'a>(&'a self) -> &'a str { + fn as_slice(&self) -> &str { unsafe { mem::transmute(&*self.vec) } } } @@ -891,7 +891,7 @@ impl ops::Deref for String { type Target = str; #[inline] - fn deref<'a>(&'a self) -> &'a str { + fn deref(&self) -> &str { unsafe { mem::transmute(&self.vec[]) } } } diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index f14b34bc2153..071c08728cb0 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -425,7 +425,7 @@ impl Vec { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] { + pub fn as_mut_slice(&mut self) -> &mut [T] { unsafe { mem::transmute(RawSlice { data: *self.ptr, @@ -737,7 +737,7 @@ impl Vec { #[inline] #[unstable(feature = "collections", reason = "matches collection reform specification, waiting for dust to settle")] - pub fn drain<'a>(&'a mut self) -> Drain<'a, T> { + pub fn drain(&mut self) -> Drain { unsafe { let begin = *self.ptr as *const T; let end = if mem::size_of::() == 0 { @@ -1278,7 +1278,7 @@ impl Index for Vec { type Output = T; #[inline] - fn index<'a>(&'a self, index: &usize) -> &'a T { + fn index(&self, index: &usize) -> &T { // NB built-in indexing via `&[T]` &(**self)[*index] } @@ -1289,7 +1289,7 @@ impl IndexMut for Vec { type Output = T; #[inline] - fn index_mut<'a>(&'a mut self, index: &usize) -> &'a mut T { + fn index_mut(&mut self, index: &usize) -> &mut T { // NB built-in indexing via `&mut [T]` &mut (**self)[*index] } @@ -1366,12 +1366,12 @@ impl ops::IndexMut for Vec { impl ops::Deref for Vec { type Target = [T]; - fn deref<'a>(&'a self) -> &'a [T] { self.as_slice() } + fn deref(&self) -> &[T] { self.as_slice() } } #[stable(feature = "rust1", since = "1.0.0")] impl ops::DerefMut for Vec { - fn deref_mut<'a>(&'a mut self) -> &'a mut [T] { self.as_mut_slice() } + fn deref_mut(&mut self) -> &mut [T] { self.as_mut_slice() } } #[stable(feature = "rust1", since = "1.0.0")] @@ -1519,7 +1519,7 @@ impl AsSlice for Vec { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - fn as_slice<'a>(&'a self) -> &'a [T] { + fn as_slice(&self) -> &[T] { unsafe { mem::transmute(RawSlice { data: *self.ptr, @@ -1636,7 +1636,7 @@ impl Iterator for IntoIter { type Item = T; #[inline] - fn next<'a>(&'a mut self) -> Option { + fn next(&mut self) -> Option { unsafe { if self.ptr == self.end { None @@ -1671,7 +1671,7 @@ impl Iterator for IntoIter { #[stable(feature = "rust1", since = "1.0.0")] impl DoubleEndedIterator for IntoIter { #[inline] - fn next_back<'a>(&'a mut self) -> Option { + fn next_back(&mut self) -> Option { unsafe { if self.end == self.ptr { None