about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-04-23 19:33:33 -0400
committerAlex Crichton <alex@alexcrichton.com>2013-04-23 19:59:13 -0400
commit4c08a8d6c31f55bfeed0ef0c2bf8b91f90415cfe (patch)
treea21a928f49a8acf805d87b3e7d11a43b342d3cdd /src/libstd
parentc089a17854669925c008a5944d0490f1692dde7e (diff)
downloadrust-4c08a8d6c31f55bfeed0ef0c2bf8b91f90415cfe.tar.gz
rust-4c08a8d6c31f55bfeed0ef0c2bf8b91f90415cfe.zip
Removing more unnecessary unsafe blocks throughout
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/arc.rs34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs
index 8abe0262314..33aa6171de4 100644
--- a/src/libstd/arc.rs
+++ b/src/libstd/arc.rs
@@ -177,15 +177,13 @@ pub impl<T:Owned> MutexARC<T> {
      */
     #[inline(always)]
     unsafe fn access<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
-        unsafe {
-            let state = get_shared_mutable_state(&self.x);
-            // Borrowck would complain about this if the function were
-            // not already unsafe. See borrow_rwlock, far below.
-            do (&(*state).lock).lock {
-                check_poison(true, (*state).failed);
-                let _z = PoisonOnFail(&mut (*state).failed);
-                blk(&mut (*state).data)
-            }
+        let state = get_shared_mutable_state(&self.x);
+        // Borrowck would complain about this if the function were
+        // not already unsafe. See borrow_rwlock, far below.
+        do (&(*state).lock).lock {
+            check_poison(true, (*state).failed);
+            let _z = PoisonOnFail(&mut (*state).failed);
+            blk(&mut (*state).data)
         }
     }
 
@@ -195,16 +193,14 @@ pub impl<T:Owned> MutexARC<T> {
         &self,
         blk: &fn(x: &'x mut T, c: &'c Condvar) -> U) -> U
     {
-        unsafe {
-            let state = get_shared_mutable_state(&self.x);
-            do (&(*state).lock).lock_cond |cond| {
-                check_poison(true, (*state).failed);
-                let _z = PoisonOnFail(&mut (*state).failed);
-                blk(&mut (*state).data,
-                    &Condvar {is_mutex: true,
-                              failed: &mut (*state).failed,
-                              cond: cond })
-            }
+        let state = get_shared_mutable_state(&self.x);
+        do (&(*state).lock).lock_cond |cond| {
+            check_poison(true, (*state).failed);
+            let _z = PoisonOnFail(&mut (*state).failed);
+            blk(&mut (*state).data,
+                &Condvar {is_mutex: true,
+                          failed: &mut (*state).failed,
+                          cond: cond })
         }
     }
 }