1 use clippy_utils::diagnostics::span_lint_and_help;
2 use clippy_utils::{path_def_id, qpath_generic_tys};
3 use if_chain::if_chain;
4 use rustc_hir::{self as hir, def_id::DefId, QPath};
5 use rustc_lint::LateContext;
6 use rustc_span::symbol::sym;
10 pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_>, def_id: DefId) -> bool {
12 if cx.tcx.is_diagnostic_item(sym::Rc, def_id) ;
13 if let Some(arg) = qpath_generic_tys(qpath).next();
14 if let Some(id) = path_def_id(cx, arg);
15 if cx.tcx.is_diagnostic_item(sym::Mutex, id);
21 "usage of `Rc<Mutex<_>>`",
23 "consider using `Rc<RefCell<_>>` or `Arc<Mutex<_>>` instead",