From 62897747fdf6913bb36406b72325357e0964da00 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 10 May 2019 19:13:15 -0700 Subject: [PATCH] Fix unwrap.rs --- clippy_lints/src/unwrap.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clippy_lints/src/unwrap.rs b/clippy_lints/src/unwrap.rs index 9f7cdf98648..348579f75d1 100644 --- a/clippy_lints/src/unwrap.rs +++ b/clippy_lints/src/unwrap.rs @@ -2,7 +2,7 @@ use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::{declare_lint_pass, declare_tool_lint}; -use crate::utils::{in_macro, match_type, paths, span_lint_and_then, usage::is_potentially_mutated}; +use crate::utils::{higher::if_block, in_macro, match_type, paths, span_lint_and_then, usage::is_potentially_mutated}; use rustc::hir::intravisit::*; use rustc::hir::*; use syntax::source_map::Span; @@ -130,7 +130,7 @@ fn visit_branch(&mut self, cond: &'tcx Expr, branch: &'tcx Expr, else_branch: bo impl<'a, 'tcx: 'a> Visitor<'tcx> for UnwrappableVariablesVisitor<'a, 'tcx> { fn visit_expr(&mut self, expr: &'tcx Expr) { - if let ExprKind::If(cond, then, els) = &expr.node { + if let Some((cond, then, els)) = if_block(&expr) { walk_expr(self, cond); self.visit_branch(cond, then, false); if let Some(els) = els {