@@ -7,6 +7,7 @@ mod redundant_allocation;
7
7
mod type_complexity;
8
8
mod utils;
9
9
mod vec_box;
10
+ mod rc_mutex;
10
11
11
12
use rustc_hir as hir;
12
13
use rustc_hir:: intravisit:: FnKind ;
@@ -250,12 +251,19 @@ declare_clippy_lint! {
250
251
"usage of very complex types that might be better factored into `type` definitions"
251
252
}
252
253
254
+ declare_clippy_lint ! {
255
+ /// TODO
256
+ pub RC_MUTEX ,
257
+ restriction,
258
+ "usage of Mutex inside Rc"
259
+ }
260
+
253
261
pub struct Types {
254
262
vec_box_size_threshold : u64 ,
255
263
type_complexity_threshold : u64 ,
256
264
}
257
265
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 ] ) ;
259
267
260
268
impl < ' tcx > LateLintPass < ' tcx > for Types {
261
269
fn check_fn ( & mut self , cx : & LateContext < ' _ > , _: FnKind < ' _ > , decl : & FnDecl < ' _ > , _: & Body < ' _ > , _: Span , id : HirId ) {
@@ -375,6 +383,7 @@ impl Types {
375
383
triggered |= vec_box:: check ( cx, hir_ty, qpath, def_id, self . vec_box_size_threshold ) ;
376
384
triggered |= option_option:: check ( cx, hir_ty, qpath, def_id) ;
377
385
triggered |= linked_list:: check ( cx, hir_ty, def_id) ;
386
+ triggered |= rc_mutex:: check ( cx, hir_ty, qpath, def_id) ;
378
387
379
388
if triggered {
380
389
return ;
0 commit comments