ignore mutable self reference parameters

This commit is contained in:
Christoph Walcher 2020-08-07 18:03:12 +02:00
parent e03f73e627
commit bfe610cc8d
No known key found for this signature in database
GPG key ID: A193164A4D05EE44
4 changed files with 9 additions and 11 deletions

View file

@ -104,8 +104,12 @@ impl EarlyLintPass for NeedlessArbitrarySelfType {
}
},
TyKind::Rptr(lifetime, mut_ty) => {
if let TyKind::Path(None, path) = &mut_ty.ty.kind {
check_param_inner(cx, path, p.span.to(p.ty.span), &Mode::Ref(*lifetime), mut_ty.mutbl)
if_chain! {
if let TyKind::Path(None, path) = &mut_ty.ty.kind;
if let PatKind::Ident(BindingMode::ByValue(Mutability::Not), _, _) = p.pat.kind;
then {
check_param_inner(cx, path, p.span.to(p.ty.span), &Mode::Ref(*lifetime), mut_ty.mutbl)
}
}
},
_ => {},