From ceea20153c00d9a04206fe5c9331ca61baf3ee6c Mon Sep 17 00:00:00 2001 From: Aaron Power Date: Mon, 28 May 2018 09:50:25 +0200 Subject: [PATCH] Refactored nested if lets to if_chain! macro --- clippy_lints/src/reference.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clippy_lints/src/reference.rs b/clippy_lints/src/reference.rs index 0d4332b4a..ffdb02216 100644 --- a/clippy_lints/src/reference.rs +++ b/clippy_lints/src/reference.rs @@ -38,8 +38,10 @@ fn without_parens(mut e: &Expr) -> &Expr { impl EarlyLintPass for Pass { fn check_expr(&mut self, cx: &EarlyContext, e: &Expr) { - if let ExprKind::Unary(UnOp::Deref, ref deref_target) = e.node { - if let ExprKind::AddrOf(_, ref addrof_target) = without_parens(deref_target).node { + if_chain! { + if let ExprKind::Unary(UnOp::Deref, ref deref_target) = e.node; + if let ExprKind::AddrOf(_, ref addrof_target) = without_parens(deref_target).node; + then { span_lint_and_sugg( cx, DEREF_ADDROF,