11error: using a `Mutex` where an atomic would do
2- --> tests/ui/mutex_atomic.rs:9 :13
2+ --> tests/ui/mutex_atomic.rs:8 :13
33 |
44LL | let _ = Mutex::new(true);
55 | ^^^^^^^^^^^^^^^^ help: try: `std::sync::atomic::AtomicBool::new(true)`
@@ -9,31 +9,31 @@ LL | let _ = Mutex::new(true);
99 = help: to override `-D warnings` add `#[allow(clippy::mutex_atomic)]`
1010
1111error: using a `Mutex` where an atomic would do
12- --> tests/ui/mutex_atomic.rs:12 :13
12+ --> tests/ui/mutex_atomic.rs:11 :13
1313 |
1414LL | let _ = Mutex::new(5usize);
1515 | ^^^^^^^^^^^^^^^^^^ help: try: `std::sync::atomic::AtomicUsize::new(5usize)`
1616 |
1717 = help: if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
1818
1919error: using a `Mutex` where an atomic would do
20- --> tests/ui/mutex_atomic.rs:15 :13
20+ --> tests/ui/mutex_atomic.rs:14 :13
2121 |
2222LL | let _ = Mutex::new(9isize);
2323 | ^^^^^^^^^^^^^^^^^^ help: try: `std::sync::atomic::AtomicIsize::new(9isize)`
2424 |
2525 = help: if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
2626
2727error: using a `Mutex` where an atomic would do
28- --> tests/ui/mutex_atomic.rs:22 :13
28+ --> tests/ui/mutex_atomic.rs:21 :13
2929 |
3030LL | let _ = Mutex::new(&mut x as *mut u32);
3131 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::sync::atomic::AtomicPtr::new(&mut x as *mut u32)`
3232 |
3333 = help: if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
3434
3535error: using a `Mutex` where an atomic would do
36- --> tests/ui/mutex_atomic.rs:25 :13
36+ --> tests/ui/mutex_atomic.rs:24 :13
3737 |
3838LL | let _ = Mutex::new(0u32);
3939 | ^^^^^^^^^^^^^^^^ help: try: `std::sync::atomic::AtomicU32::new(0u32)`
@@ -43,69 +43,92 @@ LL | let _ = Mutex::new(0u32);
4343 = help: to override `-D warnings` add `#[allow(clippy::mutex_integer)]`
4444
4545error: using a `Mutex` where an atomic would do
46- --> tests/ui/mutex_atomic.rs:28 :13
46+ --> tests/ui/mutex_atomic.rs:27 :13
4747 |
4848LL | let _ = Mutex::new(0i32);
4949 | ^^^^^^^^^^^^^^^^ help: try: `std::sync::atomic::AtomicI32::new(0i32)`
5050 |
5151 = help: if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
5252
5353error: using a `Mutex` where an atomic would do
54- --> tests/ui/mutex_atomic.rs:32 :13
54+ --> tests/ui/mutex_atomic.rs:31 :13
5555 |
5656LL | let _ = Mutex::new(0u8);
5757 | ^^^^^^^^^^^^^^^ help: try: `std::sync::atomic::AtomicU8::new(0u8)`
5858 |
5959 = help: if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
6060
6161error: using a `Mutex` where an atomic would do
62- --> tests/ui/mutex_atomic.rs:35 :13
62+ --> tests/ui/mutex_atomic.rs:34 :13
6363 |
6464LL | let _ = Mutex::new(0i16);
6565 | ^^^^^^^^^^^^^^^^ help: try: `std::sync::atomic::AtomicI16::new(0i16)`
6666 |
6767 = help: if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
6868
6969error: using a `Mutex` where an atomic would do
70- --> tests/ui/mutex_atomic.rs:38 :25
70+ --> tests/ui/mutex_atomic.rs:37 :25
7171 |
7272LL | let _x: Mutex<i8> = Mutex::new(0);
73- | ^^^^^^^^^^^^^ help: try: `std::sync::atomic::AtomicI8::new(0)`
73+ | ^^^^^^^^^^^^^
7474 |
7575 = help: if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
76+ help: try
77+ |
78+ LL - let _x: Mutex<i8> = Mutex::new(0);
79+ LL + let _x = std::sync::atomic::AtomicI8::new(0);
80+ |
7681
7782error: using a `Mutex` where an atomic would do
78- --> tests/ui/mutex_atomic.rs:42 :13
83+ --> tests/ui/mutex_atomic.rs:41 :13
7984 |
8085LL | let _ = Mutex::new(X);
8186 | ^^^^^^^^^^^^^ help: try: `std::sync::atomic::AtomicI64::new(X)`
8287 |
8388 = help: if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
8489
8590error: using a `Mutex` where an atomic would do
86- --> tests/ui/mutex_atomic.rs:54 :30
91+ --> tests/ui/mutex_atomic.rs:53 :30
8792 |
8893LL | static MTX: Mutex<u32> = Mutex::new(0);
89- | ^^^^^^^^^^^^^ help: try: `std::sync::atomic::AtomicU32::new(0)`
94+ | ^^^^^^^^^^^^^
9095 |
9196 = help: if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
97+ help: try
98+ |
99+ LL - static MTX: Mutex<u32> = Mutex::new(0);
100+ LL + static MTX: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(0);
101+ |
92102
93103error: using a `Mutex` where an atomic would do
94- --> tests/ui/mutex_atomic.rs:60 :15
104+ --> tests/ui/mutex_atomic.rs:56 :15
95105 |
96106LL | let mtx = Mutex::new(0);
97107 | ^^^^^^^^^^^^^ help: try: `std::sync::atomic::AtomicI32::new(0)`
98108 |
99109 = help: if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
100110
101111error: using a `Mutex` where an atomic would do
102- --> tests/ui/mutex_atomic.rs:64 :22
112+ --> tests/ui/mutex_atomic.rs:60 :22
103113 |
104114LL | let reassigned = mtx;
105115 | ^^^
106116 |
107117 = help: consider using an `AtomicI32` instead
108118 = help: if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
109119
110- error: aborting due to 13 previous errors
120+ error: using a `Mutex` where an atomic would do
121+ --> tests/ui/mutex_atomic.rs:65:35
122+ |
123+ LL | let (funky_mtx): Mutex<u64> = Mutex::new(0);
124+ | ^^^^^^^^^^^^^
125+ |
126+ = help: if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
127+ help: try
128+ |
129+ LL - let (funky_mtx): Mutex<u64> = Mutex::new(0);
130+ LL + let (funky_mtx) = std::sync::atomic::AtomicU64::new(0);
131+ |
132+
133+ error: aborting due to 14 previous errors
111134
0 commit comments