mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-25 11:57:25 +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 {
|
impl EarlyLintPass for Pass {
|
||||||
fn check_expr(&mut self, cx: &EarlyContext, e: &Expr) {
|
fn check_expr(&mut self, cx: &EarlyContext, e: &Expr) {
|
||||||
if let ExprKind::Unary(UnOp::Deref, ref deref_target) = e.node {
|
if_chain! {
|
||||||
if let ExprKind::AddrOf(_, ref addrof_target) = without_parens(deref_target).node {
|
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(
|
span_lint_and_sugg(
|
||||||
cx,
|
cx,
|
||||||
DEREF_ADDROF,
|
DEREF_ADDROF,
|
||||||
|
|
Loading…
Add table
Reference in a new issue