Downgrade mutex_atomic to nursery

This commit is contained in:
Taiki Endo
2022-01-10 23:36:13 +09:00
parent b66dbe87f1
commit cf86cee4fe
6 changed files with 10 additions and 10 deletions

View File

@@ -204,7 +204,6 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
LintId::of(mut_key::MUTABLE_KEY_TYPE), LintId::of(mut_key::MUTABLE_KEY_TYPE),
LintId::of(mut_mutex_lock::MUT_MUTEX_LOCK), LintId::of(mut_mutex_lock::MUT_MUTEX_LOCK),
LintId::of(mut_reference::UNNECESSARY_MUT_PASSED), 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_arbitrary_self_type::NEEDLESS_ARBITRARY_SELF_TYPE),
LintId::of(needless_bool::BOOL_COMPARISON), LintId::of(needless_bool::BOOL_COMPARISON),
LintId::of(needless_bool::NEEDLESS_BOOL), LintId::of(needless_bool::NEEDLESS_BOOL),

View File

@@ -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(let_if_seq::USELESS_LET_IF_SEQ),
LintId::of(missing_const_for_fn::MISSING_CONST_FOR_FN), LintId::of(missing_const_for_fn::MISSING_CONST_FOR_FN),
LintId::of(mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL), LintId::of(mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL),
LintId::of(mutex_atomic::MUTEX_ATOMIC),
LintId::of(mutex_atomic::MUTEX_INTEGER), LintId::of(mutex_atomic::MUTEX_INTEGER),
LintId::of(non_send_fields_in_send_ty::NON_SEND_FIELDS_IN_SEND_TY), LintId::of(non_send_fields_in_send_ty::NON_SEND_FIELDS_IN_SEND_TY),
LintId::of(nonstandard_macro_braces::NONSTANDARD_MACRO_BRACES), LintId::of(nonstandard_macro_braces::NONSTANDARD_MACRO_BRACES),

View File

@@ -19,7 +19,6 @@ store.register_group(true, "clippy::perf", Some("clippy_perf"), vec![
LintId::of(methods::SINGLE_CHAR_PATTERN), LintId::of(methods::SINGLE_CHAR_PATTERN),
LintId::of(methods::UNNECESSARY_TO_OWNED), LintId::of(methods::UNNECESSARY_TO_OWNED),
LintId::of(misc::CMP_OWNED), LintId::of(misc::CMP_OWNED),
LintId::of(mutex_atomic::MUTEX_ATOMIC),
LintId::of(redundant_clone::REDUNDANT_CLONE), LintId::of(redundant_clone::REDUNDANT_CLONE),
LintId::of(slow_vector_initialization::SLOW_VECTOR_INITIALIZATION), LintId::of(slow_vector_initialization::SLOW_VECTOR_INITIALIZATION),
LintId::of(stable_sort_primitive::STABLE_SORT_PRIMITIVE), LintId::of(stable_sort_primitive::STABLE_SORT_PRIMITIVE),

View File

@@ -38,7 +38,7 @@ declare_clippy_lint! {
/// ``` /// ```
#[clippy::version = "pre 1.29.0"] #[clippy::version = "pre 1.29.0"]
pub MUTEX_ATOMIC, pub MUTEX_ATOMIC,
perf, nursery,
"using a mutex where an atomic value could be used instead" "using a mutex where an atomic value could be used instead"
} }

View File

@@ -1,5 +1,6 @@
#![warn(clippy::all)] #![warn(clippy::all)]
#![warn(clippy::mutex_integer)] #![warn(clippy::mutex_integer)]
#![warn(clippy::mutex_atomic)]
fn main() { fn main() {
use std::sync::Mutex; use std::sync::Mutex;

View File

@@ -1,5 +1,5 @@
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<()>` 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); LL | Mutex::new(true);
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
@@ -7,31 +7,31 @@ LL | Mutex::new(true);
= note: `-D clippy::mutex-atomic` implied by `-D warnings` = 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<()>` 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); 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<()>` 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); 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<()>` 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); 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<()>` 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); 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<()>` 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); LL | Mutex::new(0u32);
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
@@ -39,7 +39,7 @@ LL | Mutex::new(0u32);
= note: `-D clippy::mutex-integer` implied by `-D warnings` = 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<()>` 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); LL | Mutex::new(0i32);
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^