Rollup merge of #80628 - matthiaskrgr:match_ref_pats, r=varkor

reduce borrowing and (de)referencing around match patterns (clippy::match_ref_pats)
This commit is contained in:
Guillaume Gomez 2021-01-03 17:09:11 +01:00 committed by GitHub
commit ff1f21a8fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 89 additions and 91 deletions

View file

@ -938,8 +938,8 @@ impl EarlyLintPass for DeprecatedAttr {
if attr.ident().map(|ident| ident.name) == Some(n) {
if let &AttributeGate::Gated(
Stability::Deprecated(link, suggestion),
ref name,
ref reason,
name,
reason,
_,
) = g
{

View file

@ -412,7 +412,7 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
}
fn check_pat(&mut self, cx: &LateContext<'_>, p: &hir::Pat<'_>) {
if let &PatKind::Binding(_, hid, ident, _) = &p.kind {
if let PatKind::Binding(_, hid, ident, _) = p.kind {
if let hir::Node::Pat(parent_pat) = cx.tcx.hir().get(cx.tcx.hir().get_parent_node(hid))
{
if let PatKind::Struct(_, field_pats, _) = &parent_pat.kind {

View file

@ -862,11 +862,11 @@ impl EarlyLintPass for UnusedParens {
}
fn check_ty(&mut self, cx: &EarlyContext<'_>, ty: &ast::Ty) {
if let &ast::TyKind::Paren(ref r) = &ty.kind {
if let ast::TyKind::Paren(r) = &ty.kind {
match &r.kind {
&ast::TyKind::TraitObject(..) => {}
&ast::TyKind::ImplTrait(_, ref bounds) if bounds.len() > 1 => {}
&ast::TyKind::Array(_, ref len) => {
ast::TyKind::TraitObject(..) => {}
ast::TyKind::ImplTrait(_, bounds) if bounds.len() > 1 => {}
ast::TyKind::Array(_, len) => {
self.check_unused_delims_expr(
cx,
&len.value,