@@ -7,6 +7,7 @@ mod redundant_allocation;
77mod type_complexity;
88mod utils;
99mod vec_box;
10+ mod rc_mutex;
1011
1112use rustc_hir as hir;
1213use rustc_hir:: intravisit:: FnKind ;
@@ -250,12 +251,19 @@ declare_clippy_lint! {
250251 "usage of very complex types that might be better factored into `type` definitions"
251252}
252253
254+ declare_clippy_lint ! {
255+ /// TODO
256+ pub RC_MUTEX ,
257+ restriction,
258+ "usage of Mutex inside Rc"
259+ }
260+
253261pub struct Types {
254262 vec_box_size_threshold : u64 ,
255263 type_complexity_threshold : u64 ,
256264}
257265
258- impl_lint_pass ! ( Types => [ BOX_VEC , VEC_BOX , OPTION_OPTION , LINKEDLIST , BORROWED_BOX , REDUNDANT_ALLOCATION , RC_BUFFER , TYPE_COMPLEXITY ] ) ;
266+ impl_lint_pass ! ( Types => [ BOX_VEC , VEC_BOX , OPTION_OPTION , LINKEDLIST , BORROWED_BOX , REDUNDANT_ALLOCATION , RC_BUFFER , TYPE_COMPLEXITY , RC_MUTEX ] ) ;
259267
260268impl < ' tcx > LateLintPass < ' tcx > for Types {
261269 fn check_fn ( & mut self , cx : & LateContext < ' _ > , _: FnKind < ' _ > , decl : & FnDecl < ' _ > , _: & Body < ' _ > , _: Span , id : HirId ) {
@@ -375,6 +383,7 @@ impl Types {
375383 triggered |= vec_box:: check ( cx, hir_ty, qpath, def_id, self . vec_box_size_threshold ) ;
376384 triggered |= option_option:: check ( cx, hir_ty, qpath, def_id) ;
377385 triggered |= linked_list:: check ( cx, hir_ty, def_id) ;
386+ triggered |= rc_mutex:: check ( cx, hir_ty, qpath, def_id) ;
378387
379388 if triggered {
380389 return ;
0 commit comments