Skip to content

Commit 6ccd4eb

Browse files
committed
Auto merge of #10115 - rdrpenguin04:master, r=flip1995
Move `mutex_atomic` to `restriction` By #4295, the general consensus seems to be that `mutex_atomic` is not a useful lint in most cases. If anything, it could be useful as a restriction on code that for whatever reason can't use atomics. Keeping it in `clippy::nursery` is harmful to people attempting to use clippy for soundness. --- changelog: Moved [`mutex_atomic`] to `restriction` [#10115](#10115) <!-- chnagelog_checked -->
2 parents 4f3ab69 + 0298095 commit 6ccd4eb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

clippy_lints/src/mutex_atomic.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Checks for uses of mutex where an atomic value could be used
22
//!
3-
//! This lint is **warn** by default
3+
//! This lint is **allow** by default
44
55
use clippy_utils::diagnostics::span_lint;
66
use clippy_utils::ty::is_type_diagnostic_item;
@@ -20,6 +20,10 @@ declare_clippy_lint! {
2020
/// `std::sync::atomic::AtomicBool` and `std::sync::atomic::AtomicPtr` are leaner and
2121
/// faster.
2222
///
23+
/// On the other hand, `Mutex`es are, in general, easier to
24+
/// verify correctness. An atomic does not behave the same as
25+
/// an equivalent mutex. See [this issue](https://github.com/rust-lang/rust-clippy/issues/4295)'s commentary for more details.
26+
///
2327
/// ### Known problems
2428
/// This lint cannot detect if the mutex is actually used
2529
/// for waiting before a critical section.
@@ -39,8 +43,8 @@ declare_clippy_lint! {
3943
/// ```
4044
#[clippy::version = "pre 1.29.0"]
4145
pub MUTEX_ATOMIC,
42-
nursery,
43-
"using a mutex where an atomic value could be used instead"
46+
restriction,
47+
"using a mutex where an atomic value could be used instead."
4448
}
4549

4650
declare_clippy_lint! {

0 commit comments

Comments
 (0)