Skip to content

Commit 0298095

Browse files
author
Ray Redondo
committed
add comment about mutex_atomic issue to description
1 parent 0e5fcb7 commit 0298095

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

clippy_lints/src/mutex_atomic.rs

+6-2
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.
@@ -40,7 +44,7 @@ declare_clippy_lint! {
4044
#[clippy::version = "pre 1.29.0"]
4145
pub MUTEX_ATOMIC,
4246
restriction,
43-
"using a mutex where an atomic value could be used instead"
47+
"using a mutex where an atomic value could be used instead."
4448
}
4549

4650
declare_clippy_lint! {

0 commit comments

Comments
 (0)