Skip to content

Commit 3bf71a8

Browse files
committed
Use match ergonomics for assign_ops lint
1 parent 79cd95c commit 3bf71a8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

clippy_lints/src/assign_ops.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ impl LintPass for AssignOps {
7070

7171
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
7272
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) {
73-
match expr.node {
74-
hir::ExprKind::AssignOp(op, ref lhs, ref rhs) => {
75-
if let hir::ExprKind::Binary(binop, ref l, ref r) = rhs.node {
73+
match &expr.node {
74+
hir::ExprKind::AssignOp(op, lhs, rhs) => {
75+
if let hir::ExprKind::Binary(binop, l, r) = &rhs.node {
7676
if op.node == binop.node {
7777
let lint = |assignee: &hir::Expr, rhs_other: &hir::Expr| {
7878
span_lint_and_then(
@@ -122,8 +122,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
122122
}
123123
}
124124
},
125-
hir::ExprKind::Assign(ref assignee, ref e) => {
126-
if let hir::ExprKind::Binary(op, ref l, ref r) = e.node {
125+
hir::ExprKind::Assign(assignee, e) => {
126+
if let hir::ExprKind::Binary(op, l, r) = &e.node {
127127
#[allow(clippy::cyclomatic_complexity)]
128128
let lint = |assignee: &hir::Expr, rhs: &hir::Expr| {
129129
let ty = cx.tables.expr_ty(assignee);
@@ -150,8 +150,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
150150
if_chain! {
151151
if parent_impl != ast::CRATE_NODE_ID;
152152
if let hir::Node::Item(item) = cx.tcx.hir().get(parent_impl);
153-
if let hir::ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, _) =
154-
item.node;
153+
if let hir::ItemKind::Impl(_, _, _, _, Some(trait_ref), _, _) =
154+
&item.node;
155155
if trait_ref.path.def.def_id() == trait_id;
156156
then { return; }
157157
}

0 commit comments

Comments
 (0)