diff options
| author | bors <bors@rust-lang.org> | 2016-03-23 08:59:10 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-03-23 08:59:10 -0700 |
| commit | b76f818cad31c7910fb6f0fa5e628dbaf4db1108 (patch) | |
| tree | 90110988cefffe1b4a5c104e92eae64f798d4cab /src/libstd/sync | |
| parent | 26cfc269a0ec6a7c895c38954e9701b62940df07 (diff) | |
| parent | c063c5153f778893d6d7296da1c8717ed8212bec (diff) | |
| download | rust-b76f818cad31c7910fb6f0fa5e628dbaf4db1108.tar.gz rust-b76f818cad31c7910fb6f0fa5e628dbaf4db1108.zip | |
Auto merge of #32390 - japaric:untry, r=pnkfelix
convert 99.9% of `try!`s to `?`s The first commit is an automated conversion using the [untry] tool and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [untry]: https://github.com/japaric/untry cc @rust-lang/lang @alexcrichton @brson
Diffstat (limited to 'src/libstd/sync')
| -rw-r--r-- | src/libstd/sync/mutex.rs | 4 | ||||
| -rw-r--r-- | src/libstd/sync/rwlock.rs | 8 |
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) } |
