Skip to content

Commit

Permalink
Downgrade mutex_atomic to nursery
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Jan 10, 2022
1 parent b66dbe8 commit cf86cee
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
1 change: 0 additions & 1 deletion clippy_lints/src/lib.register_all.rs
Expand Up @@ -204,7 +204,6 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
LintId::of(mut_key::MUTABLE_KEY_TYPE),
LintId::of(mut_mutex_lock::MUT_MUTEX_LOCK),
LintId::of(mut_reference::UNNECESSARY_MUT_PASSED),
LintId::of(mutex_atomic::MUTEX_ATOMIC),
LintId::of(needless_arbitrary_self_type::NEEDLESS_ARBITRARY_SELF_TYPE),
LintId::of(needless_bool::BOOL_COMPARISON),
LintId::of(needless_bool::NEEDLESS_BOOL),
Expand Down
1 change: 1 addition & 0 deletions clippy_lints/src/lib.register_nursery.rs
Expand Up @@ -17,6 +17,7 @@ store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![
LintId::of(let_if_seq::USELESS_LET_IF_SEQ),
LintId::of(missing_const_for_fn::MISSING_CONST_FOR_FN),
LintId::of(mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL),
LintId::of(mutex_atomic::MUTEX_ATOMIC),
LintId::of(mutex_atomic::MUTEX_INTEGER),
LintId::of(non_send_fields_in_send_ty::NON_SEND_FIELDS_IN_SEND_TY),
LintId::of(nonstandard_macro_braces::NONSTANDARD_MACRO_BRACES),
Expand Down
1 change: 0 additions & 1 deletion clippy_lints/src/lib.register_perf.rs
Expand Up @@ -19,7 +19,6 @@ store.register_group(true, "clippy::perf", Some("clippy_perf"), vec![
LintId::of(methods::SINGLE_CHAR_PATTERN),
LintId::of(methods::UNNECESSARY_TO_OWNED),
LintId::of(misc::CMP_OWNED),
LintId::of(mutex_atomic::MUTEX_ATOMIC),
LintId::of(redundant_clone::REDUNDANT_CLONE),
LintId::of(slow_vector_initialization::SLOW_VECTOR_INITIALIZATION),
LintId::of(stable_sort_primitive::STABLE_SORT_PRIMITIVE),
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/mutex_atomic.rs
Expand Up @@ -38,7 +38,7 @@ declare_clippy_lint! {
/// ```
#[clippy::version = "pre 1.29.0"]
pub MUTEX_ATOMIC,
perf,
nursery,
"using a mutex where an atomic value could be used instead"
}

Expand Down
1 change: 1 addition & 0 deletions tests/ui/mutex_atomic.rs
@@ -1,5 +1,6 @@
#![warn(clippy::all)]
#![warn(clippy::mutex_integer)]
#![warn(clippy::mutex_atomic)]

fn main() {
use std::sync::Mutex;
Expand Down
14 changes: 7 additions & 7 deletions tests/ui/mutex_atomic.stderr
@@ -1,45 +1,45 @@
error: consider using an `AtomicBool` instead of a `Mutex` here; if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
--> $DIR/mutex_atomic.rs:6:5
--> $DIR/mutex_atomic.rs:7:5
|
LL | Mutex::new(true);
| ^^^^^^^^^^^^^^^^
|
= note: `-D clippy::mutex-atomic` implied by `-D warnings`

error: consider using an `AtomicUsize` instead of a `Mutex` here; if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
--> $DIR/mutex_atomic.rs:7:5
--> $DIR/mutex_atomic.rs:8:5
|
LL | Mutex::new(5usize);
| ^^^^^^^^^^^^^^^^^^

error: consider using an `AtomicIsize` instead of a `Mutex` here; if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
--> $DIR/mutex_atomic.rs:8:5
--> $DIR/mutex_atomic.rs:9:5
|
LL | Mutex::new(9isize);
| ^^^^^^^^^^^^^^^^^^

error: consider using an `AtomicPtr` instead of a `Mutex` here; if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
--> $DIR/mutex_atomic.rs:10:5
--> $DIR/mutex_atomic.rs:11:5
|
LL | Mutex::new(&x as *const u32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: consider using an `AtomicPtr` instead of a `Mutex` here; if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
--> $DIR/mutex_atomic.rs:11:5
--> $DIR/mutex_atomic.rs:12:5
|
LL | Mutex::new(&mut x as *mut u32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: consider using an `AtomicUsize` instead of a `Mutex` here; if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
--> $DIR/mutex_atomic.rs:12:5
--> $DIR/mutex_atomic.rs:13:5
|
LL | Mutex::new(0u32);
| ^^^^^^^^^^^^^^^^
|
= note: `-D clippy::mutex-integer` implied by `-D warnings`

error: consider using an `AtomicIsize` instead of a `Mutex` here; if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
--> $DIR/mutex_atomic.rs:13:5
--> $DIR/mutex_atomic.rs:14:5
|
LL | Mutex::new(0i32);
| ^^^^^^^^^^^^^^^^
Expand Down

0 comments on commit cf86cee

Please sign in to comment.