mut_mut: Delay macro check

This commit is contained in:
Jason Newcomb 2024-06-13 19:12:10 -04:00
parent c22608823f
commit 139dad8849

View File

@ -35,25 +35,11 @@ impl<'tcx> LateLintPass<'tcx> for MutMut {
}
fn check_ty(&mut self, cx: &LateContext<'tcx>, ty: &'tcx hir::Ty<'_>) {
if in_external_macro(cx.sess(), ty.span) {
return;
}
if let hir::TyKind::Ref(
_,
hir::MutTy {
ty: pty,
mutbl: hir::Mutability::Mut,
},
) = ty.kind
{
if let hir::TyKind::Ref(
_,
hir::MutTy {
mutbl: hir::Mutability::Mut,
..
},
) = pty.kind
if let hir::TyKind::Ref(_, mty) = ty.kind
&& mty.mutbl == hir::Mutability::Mut
&& let hir::TyKind::Ref(_, mty) = mty.ty.kind
&& mty.mutbl == hir::Mutability::Mut
&& !in_external_macro(cx.sess(), ty.span)
{
span_lint(
cx,
@ -63,7 +49,6 @@ impl<'tcx> LateLintPass<'tcx> for MutMut {
);
}
}
}
}
pub struct MutVisitor<'a, 'tcx> {