about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexis <a.beingessner@gmail.com>2015-02-05 13:48:20 -0500
committerAlexis <a.beingessner@gmail.com>2015-02-05 18:25:03 -0500
commit1420cebebd48a187d8639243beaf207a0dd90853 (patch)
tree48967da134be17131ca7b98a8a3bb3faf75d73be
parente250fe388b3455c067ad87dd3e3b5f6585850fcb (diff)
remove unecessary lifetimes from a bunch of collections code
-rw-r--r--src/libcollections/binary_heap.rs2
-rw-r--r--src/libcollections/ring_buf.rs12
-rw-r--r--src/libcollections/slice.rs52
-rw-r--r--src/libcollections/str.rs8
-rw-r--r--src/libcollections/string.rs8
-rw-r--r--src/libcollections/vec.rs18
6 files changed, 50 insertions, 50 deletions
diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs
index fe477c3495f..3bc5b0ca053 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 85c4a64c0c1..8c219418309 100644
--- a/src/libcollections/ring_buf.rs
+++ b/src/libcollections/ring_buf.rs
@@ -529,13 +529,13 @@ impl<T> RingBuf<T> {
     /// assert_eq!(&buf.iter_mut().collect::<Vec<&mut i32>>()[], 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<T> {
         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<T> RingBuf<T> {
     #[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<T> RingBuf<T> {
     #[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<A> Index<usize> for RingBuf<A> {
     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<A> IndexMut<usize> for RingBuf<A> {
     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 3fe3fe04a54..eb7e1b10c9b 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -812,27 +812,27 @@ impl<T> 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<T> {
         core_slice::SliceExt::iter(self)
     }
 
@@ -855,42 +855,42 @@ impl<T> SliceExt for [T] {
     }
 
     #[inline]
-    fn windows<'a>(&'a self, size: usize) -> Windows<'a, T> {
+    fn windows(&self, size: usize) -> Windows<T> {
         core_slice::SliceExt::windows(self, size)
     }
 
     #[inline]
-    fn chunks<'a>(&'a self, size: usize) -> Chunks<'a, T> {
+    fn chunks(&self, size: usize) -> Chunks<T> {
         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<T> 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<T> {
         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<T> 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<T> {
         core_slice::SliceExt::chunks_mut(self, chunk_size)
     }
 
@@ -994,7 +994,7 @@ impl<T> 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<T> 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 e6fb3005ff3..65c397359f4 100644
--- a/src/libcollections/str.rs
+++ b/src/libcollections/str.rs
@@ -464,7 +464,7 @@ pub trait StrExt: Index<RangeFull, Output = str> {
     #[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<RangeFull, Output = str> {
     #[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<RangeFull, Output = str> {
     #[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<RangeFull, Output = str> {
     #[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 e3db8d04d4a..cf2d4415412 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<u8> {
+    pub unsafe fn as_mut_vec(&mut self) -> &mut Vec<u8> {
         &mut self.vec
     }
 
@@ -803,7 +803,7 @@ impl<'a, 'b> PartialEq<CowString<'a>> 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 f14b34bc215..071c08728cb 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -425,7 +425,7 @@ impl<T> Vec<T> {
     /// ```
     #[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<T> Vec<T> {
     #[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<T> {
         unsafe {
             let begin = *self.ptr as *const T;
             let end = if mem::size_of::<T>() == 0 {
@@ -1278,7 +1278,7 @@ impl<T> Index<usize> for Vec<T> {
     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<T> IndexMut<usize> for Vec<T> {
     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<T> ops::IndexMut<ops::RangeFull> for Vec<T> {
 impl<T> ops::Deref for Vec<T> {
     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<T> ops::DerefMut for Vec<T> {
-    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<T> AsSlice<T> for Vec<T> {
     /// ```
     #[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<T> Iterator for IntoIter<T> {
     type Item = T;
 
     #[inline]
-    fn next<'a>(&'a mut self) -> Option<T> {
+    fn next(&mut self) -> Option<T> {
         unsafe {
             if self.ptr == self.end {
                 None
@@ -1671,7 +1671,7 @@ impl<T> Iterator for IntoIter<T> {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> DoubleEndedIterator for IntoIter<T> {
     #[inline]
-    fn next_back<'a>(&'a mut self) -> Option<T> {
+    fn next_back(&mut self) -> Option<T> {
         unsafe {
             if self.end == self.ptr {
                 None