]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/unwrap.rs
Rollup merge of #87166 - de-vri-es:show-discriminant-before-overflow, r=jackh726
[rust.git] / src / tools / clippy / clippy_lints / src / unwrap.rs
index c5b8acb9982d888b2666758e43e56f0e0a48ca53..bffd9f3612b0a978ffb6426b9fc3932bfb728f87 100644 (file)
@@ -1,4 +1,5 @@
 use clippy_utils::diagnostics::span_lint_and_then;
+use clippy_utils::higher;
 use clippy_utils::ty::is_type_diagnostic_item;
 use clippy_utils::{differing_macro_contexts, usage::is_potentially_mutated};
 use if_chain::if_chain;
@@ -160,11 +161,11 @@ fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
         if in_external_macro(self.cx.tcx.sess, expr.span) {
             return;
         }
-        if let ExprKind::If(cond, then, els) = &expr.kind {
+        if let Some(higher::If { cond, then, r#else }) = higher::If::hir(expr) {
             walk_expr(self, cond);
             self.visit_branch(cond, then, false);
-            if let Some(els) = els {
-                self.visit_branch(cond, els, true);
+            if let Some(else_inner) = r#else {
+                self.visit_branch(cond, else_inner, true);
             }
         } else {
             // find `unwrap[_err]()` calls: