From 0f02309e4b0ea05ee905205278fb6d131341c41f Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Tue, 22 Mar 2016 22:01:37 -0500 Subject: try! -> ? Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry --- src/libstd/sync/mutex.rs | 4 ++-- src/libstd/sync/rwlock.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/libstd/sync') 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 Mutex { pub fn try_lock(&self) -> TryLockResult> { 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> { 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 RwLock { pub fn try_read(&self) -> TryLockResult> { 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 RwLock { pub fn try_write(&self) -> TryLockResult> { 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> { 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> { unsafe { if self.lock.try_write() { - Ok(try!(RwLockWriteGuard::new(self, &DUMMY.0))) + Ok(RwLockWriteGuard::new(self, &DUMMY.0)?) } else { Err(TryLockError::WouldBlock) } -- cgit 1.4.1-3-g733a5