]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/blocks_in_if_conditions.rs
Auto merge of #81993 - flip1995:clippyup, r=Manishearth
[rust.git] / clippy_lints / src / blocks_in_if_conditions.rs
index 1b73ced89b32bfc8e95e6ca76819c072c0edbe8d..4efca10bcdf13d650cdff8067231ae3f8f32d4f5 100644 (file)
@@ -1,4 +1,4 @@
-use crate::utils::{differing_macro_contexts, higher, snippet_block_with_applicability, span_lint, span_lint_and_sugg};
+use crate::utils::{differing_macro_contexts, snippet_block_with_applicability, span_lint, span_lint_and_sugg};
 use rustc_errors::Applicability;
 use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
 use rustc_hir::{BlockCheckMode, Expr, ExprKind};
@@ -28,7 +28,6 @@
     ///
     /// ```rust
     /// # fn somefunc() -> bool { true };
-    ///
     /// // Bad
     /// if { let x = somefunc(); x } { /* ... */ }
     ///
@@ -76,7 +75,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
         if in_external_macro(cx.sess(), expr.span) {
             return;
         }
-        if let Some((cond, _, _)) = higher::if_block(&expr) {
+        if let ExprKind::If(cond, _, _) = &expr.kind {
             if let ExprKind::Block(block, _) = &cond.kind {
                 if block.rules == BlockCheckMode::DefaultBlock {
                     if block.stmts.is_empty() {