Skip to content

Commit

Permalink
add comment about mutex_atomic issue to description
Browse files Browse the repository at this point in the history
  • Loading branch information
Ray Redondo committed Dec 29, 2022
1 parent 0e5fcb7 commit 0298095
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions clippy_lints/src/mutex_atomic.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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.
Expand All @@ -40,7 +44,7 @@ declare_clippy_lint! {
#[clippy::version = "pre 1.29.0"]
pub MUTEX_ATOMIC,
restriction,
"using a mutex where an atomic value could be used instead"
"using a mutex where an atomic value could be used instead."
}

declare_clippy_lint! {
Expand Down

0 comments on commit 0298095

Please sign in to comment.