]> git.lizzy.rs Git - rust.git/blobdiff - src/libstd/sys/common/remutex.rs
Auto merge of #30641 - tsion:match-range, r=eddyb
[rust.git] / src / libstd / sys / common / remutex.rs
index 4df3441f87b2134ed11241c5ebeefda9f8011893..31caa68c4b7ea70bcd89871e305a68076738eebf 100644 (file)
@@ -67,7 +67,7 @@ pub fn new(t: T) -> ReentrantMutex<T> {
                 data: t,
             };
             mutex.inner.init();
-            return mutex
+            mutex
         }
     }
 
@@ -145,7 +145,7 @@ fn new(lock: &'mutex ReentrantMutex<T>)
 impl<'mutex, T> Deref for ReentrantMutexGuard<'mutex, T> {
     type Target = T;
 
-    fn deref<'a>(&'a self) -> &'a T {
+    fn deref(&self) -> &T {
         &self.__lock.data
     }
 }
@@ -167,7 +167,6 @@ mod tests {
     use sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard};
     use cell::RefCell;
     use sync::Arc;
-    use boxed;
     use thread;
 
     #[test]
@@ -208,13 +207,13 @@ fn is_mutex() {
     fn trylock_works() {
         let m = Arc::new(ReentrantMutex::new(()));
         let m2 = m.clone();
-        let lock = m.try_lock().unwrap();
-        let lock2 = m.try_lock().unwrap();
+        let _lock = m.try_lock().unwrap();
+        let _lock2 = m.try_lock().unwrap();
         thread::spawn(move || {
             let lock = m2.try_lock();
             assert!(lock.is_err());
         }).join().unwrap();
-        let lock3 = m.try_lock().unwrap();
+        let _lock3 = m.try_lock().unwrap();
     }
 
     pub struct Answer<'a>(pub ReentrantMutexGuard<'a, RefCell<u32>>);
@@ -233,9 +232,8 @@ fn poison_works() {
             *lock.borrow_mut() = 1;
             let lock2 = mc.lock().unwrap();
             *lock.borrow_mut() = 2;
-            let answer = Answer(lock2);
+            let _answer = Answer(lock2);
             panic!("What the answer to my lifetimes dilemma is?");
-            drop(answer);
         }).join();
         assert!(result.is_err());
         let r = m.lock().err().unwrap().into_inner();