diff options
| author | Trevor Gross <t.gross35@gmail.com> | 2025-06-20 02:50:39 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-20 02:50:39 -0400 |
| commit | 52758b7329d436979f8bd8a36d1ca4c476a663fd (patch) | |
| tree | 0848fd0e6917402f5dda00c29fc82450d8fd5bb2 /library/coretests | |
| parent | e381a14b7cb07eb3be4da73a032cb8f4481a05b9 (diff) | |
| parent | 9c2276818369d20e683497459b85e93d9c5aee84 (diff) | |
| download | rust-52758b7329d436979f8bd8a36d1ca4c476a663fd.tar.gz rust-52758b7329d436979f8bd8a36d1ca4c476a663fd.zip | |
Rollup merge of #142668 - hkBst:less-static-mut, r=tgross35
vec_deque/fmt/vec tests: remove static mut More rust-lang/rust#125035. r? ```@tgross35```
Diffstat (limited to 'library/coretests')
| -rw-r--r-- | library/coretests/tests/atomic.rs | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/library/coretests/tests/atomic.rs b/library/coretests/tests/atomic.rs index e0c0fe4790c..b1ab443aa6e 100644 --- a/library/coretests/tests/atomic.rs +++ b/library/coretests/tests/atomic.rs @@ -228,24 +228,20 @@ fn static_init() { } #[test] -// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint -#[allow(static_mut_refs)] fn atomic_access_bool() { - static mut ATOMIC: AtomicBool = AtomicBool::new(false); - - unsafe { - assert_eq!(*ATOMIC.get_mut(), false); - ATOMIC.store(true, SeqCst); - assert_eq!(*ATOMIC.get_mut(), true); - ATOMIC.fetch_or(false, SeqCst); - assert_eq!(*ATOMIC.get_mut(), true); - ATOMIC.fetch_and(false, SeqCst); - assert_eq!(*ATOMIC.get_mut(), false); - ATOMIC.fetch_nand(true, SeqCst); - assert_eq!(*ATOMIC.get_mut(), true); - ATOMIC.fetch_xor(true, SeqCst); - assert_eq!(*ATOMIC.get_mut(), false); - } + let mut atom = AtomicBool::new(false); + + assert_eq!(*atom.get_mut(), false); + atom.store(true, SeqCst); + assert_eq!(*atom.get_mut(), true); + atom.fetch_or(false, SeqCst); + assert_eq!(*atom.get_mut(), true); + atom.fetch_and(false, SeqCst); + assert_eq!(*atom.get_mut(), false); + atom.fetch_nand(true, SeqCst); + assert_eq!(*atom.get_mut(), true); + atom.fetch_xor(true, SeqCst); + assert_eq!(*atom.get_mut(), false); } #[test] |
