We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5dd7617 commit 646ff2dCopy full SHA for 646ff2d
clippy_lints/src/mut_mut.rs
@@ -54,13 +54,15 @@ impl<'tcx> LateLintPass<'tcx> for MutMut {
54
if self.seen_tys.contains(&ty.hir_id) {
55
return;
56
}
57
- self.seen_tys.insert(mty.ty.hir_id);
58
59
// if there is an even longer chain, like `&mut &mut &mut x`, suggest peeling off
60
// all extra ones at once
61
let (mut t, mut t2) = (mty.ty, mty2.ty);
62
let mut many_muts = false;
63
loop {
+ // this should allow us to remember all the nested types, so that the `contains`
64
+ // above fails faster
65
+ self.seen_tys.insert(t.hir_id);
66
if let TyKind::Ref(_, next) = t2.kind
67
&& next.mutbl == Mutability::Mut
68
{
0 commit comments