mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 01:17:16 +00:00
Use AtomicU8 in ordering example so all operations can be demonstrated
This commit is contained in:
parent
159178e5d4
commit
b65745545f
1 changed files with 7 additions and 7 deletions
|
@ -18,22 +18,22 @@ declare_clippy_lint! {
|
||||||
///
|
///
|
||||||
/// **Example:**
|
/// **Example:**
|
||||||
/// ```rust,no_run
|
/// ```rust,no_run
|
||||||
/// # use std::sync::atomic::{self, AtomicBool, Ordering};
|
/// # use std::sync::atomic::{self, AtomicU8, Ordering};
|
||||||
///
|
///
|
||||||
/// let x = AtomicBool::new(true);
|
/// let x = AtomicU8::new(0);
|
||||||
///
|
///
|
||||||
/// let _ = x.load(Ordering::Release);
|
/// let _ = x.load(Ordering::Release);
|
||||||
/// let _ = x.load(Ordering::AcqRel);
|
/// let _ = x.load(Ordering::AcqRel);
|
||||||
///
|
///
|
||||||
/// x.store(false, Ordering::Acquire);
|
/// x.store(1, Ordering::Acquire);
|
||||||
/// x.store(false, Ordering::AcqRel);
|
/// x.store(2, Ordering::AcqRel);
|
||||||
///
|
///
|
||||||
/// atomic::fence(Ordering::Relaxed);
|
/// atomic::fence(Ordering::Relaxed);
|
||||||
/// atomic::compiler_fence(Ordering::Relaxed);
|
/// atomic::compiler_fence(Ordering::Relaxed);
|
||||||
///
|
///
|
||||||
/// let _ = x.compare_exchange(false, false, Ordering::Relaxed, Ordering::SeqCst);
|
/// let _ = x.compare_exchange(1, 2, Ordering::Relaxed, Ordering::SeqCst);
|
||||||
/// let _ = x.compare_exchange_weak(false, true, Ordering::SeqCst, Ordering::Release);
|
/// let _ = x.compare_exchange_weak(2, 3, Ordering::SeqCst, Ordering::Release);
|
||||||
/// let _ = x.fetch_update(Ordering::AcqRel, Ordering::AcqRel, |val| Some(val ^ val));
|
/// let _ = x.fetch_update(Ordering::AcqRel, Ordering::AcqRel, |val| Some(val + val));
|
||||||
/// ```
|
/// ```
|
||||||
pub INVALID_ATOMIC_ORDERING,
|
pub INVALID_ATOMIC_ORDERING,
|
||||||
correctness,
|
correctness,
|
||||||
|
|
Loading…
Reference in a new issue