diff options
| author | Kornel <kornel@geekhood.net> | 2024-12-20 17:02:46 +0000 |
|---|---|---|
| committer | Kornel <kornel@geekhood.net> | 2024-12-21 01:26:47 +0000 |
| commit | 7b42bc0c7935e9f5fefd017249041d64f27bb583 (patch) | |
| tree | 5b65fd21829609d725f852c11e141aa59573e349 /library/core/src/sync | |
| parent | 5f23ef7d3f7a8c3e0ca5c4e1978829c0448a3686 (diff) | |
Less unwrap() in documentation
Diffstat (limited to 'library/core/src/sync')
| -rw-r--r-- | library/core/src/sync/atomic.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs index 487fffba881..fda26a67299 100644 --- a/library/core/src/sync/atomic.rs +++ b/library/core/src/sync/atomic.rs @@ -86,7 +86,7 @@ //! // This is fine: `join` synchronizes the code in a way such that the atomic //! // store happens-before the non-atomic write. //! let handle = s.spawn(|| atomic.store(1, Ordering::Relaxed)); // atomic store -//! handle.join().unwrap(); // synchronize +//! handle.join().expect("thread won't panic"); // synchronize //! s.spawn(|| unsafe { atomic.as_ptr().write(2) }); // non-atomic write //! }); //! @@ -103,7 +103,7 @@ //! // This is fine: `join` synchronizes the code in a way such that //! // the 1-byte store happens-before the 2-byte store. //! let handle = s.spawn(|| atomic.store(1, Ordering::Relaxed)); -//! handle.join().unwrap(); +//! handle.join().expect("thread won't panic"); //! s.spawn(|| unsafe { //! let differently_sized = transmute::<&AtomicU16, &AtomicU8>(&atomic); //! differently_sized.store(2, Ordering::Relaxed); |
