Skip to content

Commit e48a738

Browse files
committed
added non-poison mutex
1 parent d2fa246 commit e48a738

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

library/std/src/sync/nonpoison/mutex.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,13 @@ impl<T: ?Sized> Mutex<T> {
219219
/// ```
220220
#[unstable(feature = "nonpoison_mutex", issue = "134645")]
221221
pub fn try_lock(&self) -> Option<MutexGuard<'_, T>> {
222-
unsafe { if self.inner.try_lock() { Some(MutexGuard::new(self)) } else { None } }
222+
unsafe {
223+
if self.inner.try_lock() {
224+
Some(MutexGuard::new(self))
225+
} else {
226+
None
227+
}
228+
}
223229
}
224230

225231
/// Consumes this mutex, returning the underlying data.

0 commit comments

Comments
 (0)