about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOGINO Masanori <masanori.ogino@gmail.com>2014-07-31 07:56:39 +0900
committerAlex Crichton <alex@alexcrichton.com>2014-07-31 11:50:24 -0700
commitf86184869a95199a2e0da844ad257c67f1aac97a (patch)
tree5042e78e28e8a5fd15305690af86435d1b7f7b2e
parent2467c6e5a7fe008c33fdc1060a5ce869d6219a92 (diff)
downloadrust-f86184869a95199a2e0da844ad257c67f1aac97a.tar.gz
rust-f86184869a95199a2e0da844ad257c67f1aac97a.zip
alloc, arena, test, url, uuid: Elide lifetimes.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
-rw-r--r--src/liballoc/rc.rs10
-rw-r--r--src/libarena/lib.rs12
-rw-r--r--src/libtest/stats.rs2
-rw-r--r--src/liburl/lib.rs11
-rw-r--r--src/libuuid/lib.rs2
5 files changed, 18 insertions, 19 deletions
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs
index b31931c6de3..35914aa3541 100644
--- a/src/liballoc/rc.rs
+++ b/src/liballoc/rc.rs
@@ -226,7 +226,7 @@ impl<T: Clone> Rc<T> {
     /// data is cloned if the reference count is greater than one.
     #[inline]
     #[experimental]
-    pub fn make_unique<'a>(&'a mut self) -> &'a mut T {
+    pub fn make_unique(&mut self) -> &mut T {
         // Note that we hold a strong reference, which also counts as
         // a weak reference, so we only clone if there is an
         // additional reference of either kind.
@@ -247,7 +247,7 @@ impl<T: Clone> Rc<T> {
 impl<T> Deref<T> for Rc<T> {
     /// Borrow the value contained in the reference-counted box
     #[inline(always)]
-    fn deref<'a>(&'a self) -> &'a T {
+    fn deref(&self) -> &T {
         &self.inner().value
     }
 }
@@ -390,7 +390,7 @@ impl<T> Clone for Weak<T> {
 
 #[doc(hidden)]
 trait RcBoxPtr<T> {
-    fn inner<'a>(&'a self) -> &'a RcBox<T>;
+    fn inner(&self) -> &RcBox<T>;
 
     #[inline]
     fn strong(&self) -> uint { self.inner().strong.get() }
@@ -413,12 +413,12 @@ trait RcBoxPtr<T> {
 
 impl<T> RcBoxPtr<T> for Rc<T> {
     #[inline(always)]
-    fn inner<'a>(&'a self) -> &'a RcBox<T> { unsafe { &(*self._ptr) } }
+    fn inner(&self) -> &RcBox<T> { unsafe { &(*self._ptr) } }
 }
 
 impl<T> RcBoxPtr<T> for Weak<T> {
     #[inline(always)]
-    fn inner<'a>(&'a self) -> &'a RcBox<T> { unsafe { &(*self._ptr) } }
+    fn inner(&self) -> &RcBox<T> { unsafe { &(*self._ptr) } }
 }
 
 #[cfg(test)]
diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs
index e672c555b80..5d316cdb51e 100644
--- a/src/libarena/lib.rs
+++ b/src/libarena/lib.rs
@@ -207,7 +207,7 @@ impl Arena {
     }
 
     #[inline]
-    fn alloc_copy<'a, T>(&'a self, op: || -> T) -> &'a T {
+    fn alloc_copy<T>(&self, op: || -> T) -> &T {
         unsafe {
             let ptr = self.alloc_copy_inner(mem::size_of::<T>(),
                                             mem::min_align_of::<T>());
@@ -261,7 +261,7 @@ impl Arena {
     }
 
     #[inline]
-    fn alloc_noncopy<'a, T>(&'a self, op: || -> T) -> &'a T {
+    fn alloc_noncopy<T>(&self, op: || -> T) -> &T {
         unsafe {
             let tydesc = get_tydesc::<T>();
             let (ty_ptr, ptr) =
@@ -285,7 +285,7 @@ impl Arena {
     /// Allocate a new item in the arena, using `op` to initialize the value
     /// and returning a reference to it.
     #[inline]
-    pub fn alloc<'a, T>(&'a self, op: || -> T) -> &'a T {
+    pub fn alloc<T>(&self, op: || -> T) -> &T {
         unsafe {
             if intrinsics::needs_drop::<T>() {
                 self.alloc_noncopy(op)
@@ -458,13 +458,13 @@ impl<T> TypedArena<T> {
 
     /// Allocates an object in the TypedArena, returning a reference to it.
     #[inline]
-    pub fn alloc<'a>(&'a self, object: T) -> &'a T {
+    pub fn alloc(&self, object: T) -> &T {
         if self.ptr == self.end {
             self.grow()
         }
 
-        let ptr: &'a T = unsafe {
-            let ptr: &'a mut T = mem::transmute(self.ptr);
+        let ptr: &T = unsafe {
+            let ptr: &mut T = mem::transmute(self.ptr);
             ptr::write(ptr, object);
             self.ptr.set(self.ptr.get().offset(1));
             ptr
diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs
index d8f628e2196..9af28e771e1 100644
--- a/src/libtest/stats.rs
+++ b/src/libtest/stats.rs
@@ -164,7 +164,7 @@ impl<T: FloatMath + FromPrimitive> Summary<T> {
     }
 }
 
-impl<'a,T: FloatMath + FromPrimitive> Stats<T> for &'a [T] {
+impl<'a, T: FloatMath + FromPrimitive> Stats<T> for &'a [T] {
 
     // FIXME #11059 handle NaN, inf and overflow
     fn sum(self) -> T {
diff --git a/src/liburl/lib.rs b/src/liburl/lib.rs
index c7e27c00836..0221b95b404 100644
--- a/src/liburl/lib.rs
+++ b/src/liburl/lib.rs
@@ -394,7 +394,7 @@ pub fn decode_form_urlencoded(s: &[u8])
     }
 }
 
-fn split_char_first<'a>(s: &'a str, c: char) -> (&'a str, &'a str) {
+fn split_char_first(s: &str, c: char) -> (&str, &str) {
     let mut iter = s.splitn(c, 1);
 
     match (iter.next(), iter.next()) {
@@ -466,7 +466,7 @@ pub fn query_to_str(query: &Query) -> String {
 /// };
 /// println!("Scheme in use: {}.", scheme); // Scheme in use: https.
 /// ```
-pub fn get_scheme<'a>(rawurl: &'a str) -> DecodeResult<(&'a str, &'a str)> {
+pub fn get_scheme(rawurl: &str) -> DecodeResult<(&str, &str)> {
     for (i,c) in rawurl.chars().enumerate() {
         let result = match c {
             'A' .. 'Z'
@@ -493,8 +493,8 @@ pub fn get_scheme<'a>(rawurl: &'a str) -> DecodeResult<(&'a str, &'a str)> {
 }
 
 // returns userinfo, host, port, and unparsed part, or an error
-fn get_authority<'a>(rawurl: &'a str) ->
-    DecodeResult<(Option<UserInfo>, &'a str, Option<u16>, &'a str)> {
+fn get_authority(rawurl: &str) ->
+    DecodeResult<(Option<UserInfo>, &str, Option<u16>, &str)> {
     enum State {
         Start, // starting state
         PassHostPort, // could be in user or port
@@ -662,8 +662,7 @@ fn get_authority<'a>(rawurl: &'a str) ->
 
 
 // returns the path and unparsed part of url, or an error
-fn get_path<'a>(rawurl: &'a str, is_authority: bool)
-                                            -> DecodeResult<(String, &'a str)> {
+fn get_path(rawurl: &str, is_authority: bool) -> DecodeResult<(String, &str)> {
     let len = rawurl.len();
     let mut end = len;
     for (i,c) in rawurl.chars().enumerate() {
diff --git a/src/libuuid/lib.rs b/src/libuuid/lib.rs
index d5fbb321cd8..6a5148c4a94 100644
--- a/src/libuuid/lib.rs
+++ b/src/libuuid/lib.rs
@@ -313,7 +313,7 @@ impl Uuid {
     }
 
     /// Return an array of 16 octets containing the UUID data
-    pub fn as_bytes<'a>(&'a self) -> &'a [u8] {
+    pub fn as_bytes(&self) -> &[u8] {
         self.bytes.as_slice()
     }