about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-12-30 15:49:12 +0000
committerbors <bors@rust-lang.org>2022-12-30 15:49:12 +0000
commit6ccd4ebd5ba4d68dcfb56c8dea13b90c1d02a769 (patch)
tree4a8360e733ad8f2379912f2bffaff34d2b27c6c4
parent4f3ab69ea0a0908260944443c739426cc384ae1a (diff)
parent0298095ac21e8fd5eb5ead8edc1b49a365972cc4 (diff)
downloadrust-6ccd4ebd5ba4d68dcfb56c8dea13b90c1d02a769.tar.gz
rust-6ccd4ebd5ba4d68dcfb56c8dea13b90c1d02a769.zip
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](https://github.com/rust-lang/rust-clippy/pull/10115)
<!-- chnagelog_checked -->
-rw-r--r--clippy_lints/src/mutex_atomic.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/clippy_lints/src/mutex_atomic.rs b/clippy_lints/src/mutex_atomic.rs
index 09cb5333176..dc866ab6373 100644
--- a/clippy_lints/src/mutex_atomic.rs
+++ b/clippy_lints/src/mutex_atomic.rs
@@ -1,6 +1,6 @@
 //! Checks for uses of mutex where an atomic value could be used
 //!
-//! This lint is **warn** by default
+//! This lint is **allow** by default
 
 use clippy_utils::diagnostics::span_lint;
 use clippy_utils::ty::is_type_diagnostic_item;
@@ -20,6 +20,10 @@ declare_clippy_lint! {
     /// `std::sync::atomic::AtomicBool` and `std::sync::atomic::AtomicPtr` are leaner and
     /// faster.
     ///
+    /// On the other hand, `Mutex`es are, in general, easier to
+    /// verify correctness. An atomic does not behave the same as
+    /// an equivalent mutex. See [this issue](https://github.com/rust-lang/rust-clippy/issues/4295)'s commentary for more details.
+    ///
     /// ### Known problems
     /// This lint cannot detect if the mutex is actually used
     /// for waiting before a critical section.
@@ -39,8 +43,8 @@ declare_clippy_lint! {
     /// ```
     #[clippy::version = "pre 1.29.0"]
     pub MUTEX_ATOMIC,
-    nursery,
-    "using a mutex where an atomic value could be used instead"
+    restriction,
+    "using a mutex where an atomic value could be used instead."
 }
 
 declare_clippy_lint! {