File tree Expand file tree Collapse file tree 1 file changed +11
-26
lines changed Expand file tree Collapse file tree 1 file changed +11
-26
lines changed Original file line number Diff line number Diff line change @@ -35,33 +35,18 @@ impl<'tcx> LateLintPass<'tcx> for MutMut {
3535 }
3636
3737 fn check_ty ( & mut self , cx : & LateContext < ' tcx > , ty : & ' tcx hir:: Ty < ' _ > ) {
38- if in_external_macro ( cx. sess ( ) , ty. span ) {
39- return ;
40- }
41-
42- if let hir:: TyKind :: Ref (
43- _,
44- hir:: MutTy {
45- ty : pty,
46- mutbl : hir:: Mutability :: Mut ,
47- } ,
48- ) = ty. kind
38+ if let hir:: TyKind :: Ref ( _, mty) = ty. kind
39+ && mty. mutbl == hir:: Mutability :: Mut
40+ && let hir:: TyKind :: Ref ( _, mty) = mty. ty . kind
41+ && mty. mutbl == hir:: Mutability :: Mut
42+ && !in_external_macro ( cx. sess ( ) , ty. span )
4943 {
50- if let hir:: TyKind :: Ref (
51- _,
52- hir:: MutTy {
53- mutbl : hir:: Mutability :: Mut ,
54- ..
55- } ,
56- ) = pty. kind
57- {
58- span_lint (
59- cx,
60- MUT_MUT ,
61- ty. span ,
62- "generally you want to avoid `&mut &mut _` if possible" ,
63- ) ;
64- }
44+ span_lint (
45+ cx,
46+ MUT_MUT ,
47+ ty. span ,
48+ "generally you want to avoid `&mut &mut _` if possible" ,
49+ ) ;
6550 }
6651 }
6752}
You can’t perform that action at this time.
0 commit comments