use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty::{self, Ty};
use rustc_session::{declare_lint_pass, declare_tool_lint};
+use rustc_span::sym;
declare_clippy_lint! {
/// ### What it does
/// # use std::sync::atomic::AtomicBool;
/// let x = AtomicBool::new(y);
/// ```
+ #[clippy::version = "pre 1.29.0"]
pub MUTEX_ATOMIC,
- perf,
+ nursery,
"using a mutex where an atomic value could be used instead"
}
/// # use std::sync::atomic::AtomicUsize;
/// let x = AtomicUsize::new(0usize);
/// ```
+ #[clippy::version = "pre 1.29.0"]
pub MUTEX_INTEGER,
nursery,
"using a mutex for an integer type"
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
let ty = cx.typeck_results().expr_ty(expr);
if let ty::Adt(_, subst) = ty.kind() {
- if is_type_diagnostic_item(cx, ty, sym!(mutex_type)) {
+ if is_type_diagnostic_item(cx, ty, sym::Mutex) {
let mutex_param = subst.type_at(0);
if let Some(atomic_name) = get_atomic_name(mutex_param) {
let msg = format!(