mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
Merge pull request #2809 from Aaronepower/if_chain_clean
Refactored nested if lets to if_chain! macro
This commit is contained in:
commit
d78b78760a
1 changed files with 4 additions and 2 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue