about summary refs log tree commit diff
path: root/src/libstd/sync
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/sync')
-rw-r--r--src/libstd/sync/mutex.rs4
-rw-r--r--src/libstd/sync/rwlock.rs8
2 files changed, 6 insertions, 6 deletions
diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs
index 34c9c7cf1e9..e0946a5c12a 100644
--- a/src/libstd/sync/mutex.rs
+++ b/src/libstd/sync/mutex.rs
@@ -234,7 +234,7 @@ impl<T: ?Sized> Mutex<T> {
     pub fn try_lock(&self) -> TryLockResult<MutexGuard<T>> {
         unsafe {
             if self.inner.lock.try_lock() {
-                Ok(try!(MutexGuard::new(&*self.inner, &self.data)))
+                Ok(MutexGuard::new(&*self.inner, &self.data)?)
             } else {
                 Err(TryLockError::WouldBlock)
             }
@@ -353,7 +353,7 @@ impl StaticMutex {
     pub fn try_lock(&'static self) -> TryLockResult<MutexGuard<()>> {
         unsafe {
             if self.lock.try_lock() {
-                Ok(try!(MutexGuard::new(self, &DUMMY.0)))
+                Ok(MutexGuard::new(self, &DUMMY.0)?)
             } else {
                 Err(TryLockError::WouldBlock)
             }
diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs
index 0603dad4528..a37c1c16a45 100644
--- a/src/libstd/sync/rwlock.rs
+++ b/src/libstd/sync/rwlock.rs
@@ -205,7 +205,7 @@ impl<T: ?Sized> RwLock<T> {
     pub fn try_read(&self) -> TryLockResult<RwLockReadGuard<T>> {
         unsafe {
             if self.inner.lock.try_read() {
-                Ok(try!(RwLockReadGuard::new(&*self.inner, &self.data)))
+                Ok(RwLockReadGuard::new(&*self.inner, &self.data)?)
             } else {
                 Err(TryLockError::WouldBlock)
             }
@@ -257,7 +257,7 @@ impl<T: ?Sized> RwLock<T> {
     pub fn try_write(&self) -> TryLockResult<RwLockWriteGuard<T>> {
         unsafe {
             if self.inner.lock.try_write() {
-                Ok(try!(RwLockWriteGuard::new(&*self.inner, &self.data)))
+                Ok(RwLockWriteGuard::new(&*self.inner, &self.data)?)
             } else {
                 Err(TryLockError::WouldBlock)
             }
@@ -382,7 +382,7 @@ impl StaticRwLock {
                     -> TryLockResult<RwLockReadGuard<'static, ()>> {
         unsafe {
             if self.lock.try_read(){
-                Ok(try!(RwLockReadGuard::new(self, &DUMMY.0)))
+                Ok(RwLockReadGuard::new(self, &DUMMY.0)?)
             } else {
                 Err(TryLockError::WouldBlock)
             }
@@ -409,7 +409,7 @@ impl StaticRwLock {
                      -> TryLockResult<RwLockWriteGuard<'static, ()>> {
         unsafe {
             if self.lock.try_write() {
-                Ok(try!(RwLockWriteGuard::new(self, &DUMMY.0)))
+                Ok(RwLockWriteGuard::new(self, &DUMMY.0)?)
             } else {
                 Err(TryLockError::WouldBlock)
             }