Merge pull request #2809 from Aaronepower/if_chain_clean

Refactored nested if lets to if_chain! macro
This commit is contained in:
Oliver Schneider 2018-05-28 12:44:24 +02:00 committed by GitHub
commit d78b78760a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,