Refactored nested if lets to if_chain! macro
This commit is contained in:
parent
fc008aa14c
commit
ceea20153c
@ -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…
Reference in New Issue
Block a user