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:
commit
ff1f21a8fd
28 changed files with 89 additions and 91 deletions
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue