Skip to content

Commit d78b787

Browse files
authored
Merge pull request #2809 from Aaronepower/if_chain_clean
Refactored nested if lets to if_chain! macro
2 parents fc008aa + ceea201 commit d78b787

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

clippy_lints/src/reference.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ fn without_parens(mut e: &Expr) -> &Expr {
3838

3939
impl EarlyLintPass for Pass {
4040
fn check_expr(&mut self, cx: &EarlyContext, e: &Expr) {
41-
if let ExprKind::Unary(UnOp::Deref, ref deref_target) = e.node {
42-
if let ExprKind::AddrOf(_, ref addrof_target) = without_parens(deref_target).node {
41+
if_chain! {
42+
if let ExprKind::Unary(UnOp::Deref, ref deref_target) = e.node;
43+
if let ExprKind::AddrOf(_, ref addrof_target) = without_parens(deref_target).node;
44+
then {
4345
span_lint_and_sugg(
4446
cx,
4547
DEREF_ADDROF,

0 commit comments

Comments
 (0)