diff --git a/clippy_lints/src/implicit_return.rs b/clippy_lints/src/implicit_return.rs index 559b0942d2b5..8e0fa1bf2e26 100644 --- a/clippy_lints/src/implicit_return.rs +++ b/clippy_lints/src/implicit_return.rs @@ -74,13 +74,6 @@ impl ImplicitReturn { Self::lint(cx, expr.span, break_expr.span, "change `break` to `return` as shown"); } }, - ExprKind::If(.., if_expr, else_expr) => { - Self::expr_match(cx, if_expr); - - if let Some(else_expr) = else_expr { - Self::expr_match(cx, else_expr); - } - }, ExprKind::Match(.., arms, source) => { let check_all_arms = match source { MatchSource::IfLetDesugar { diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 362f3ebdf5c4..c67edc00e6b3 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -686,14 +686,6 @@ fn never_loop_expr(expr: &Expr, main_loop_id: HirId) -> NeverLoopResult { | ExprKind::Assign(ref e1, ref e2) | ExprKind::AssignOp(_, ref e1, ref e2) | ExprKind::Index(ref e1, ref e2) => never_loop_expr_all(&mut [&**e1, &**e2].iter().cloned(), main_loop_id), - ExprKind::If(ref e, ref e2, ref e3) => { - let e1 = never_loop_expr(e, main_loop_id); - let e2 = never_loop_expr(e2, main_loop_id); - let e3 = e3 - .as_ref() - .map_or(NeverLoopResult::Otherwise, |e| never_loop_expr(e, main_loop_id)); - combine_seq(e1, combine_branches(e2, e3)) - }, ExprKind::Loop(ref b, _, _) => { // Break can come from the inner loop so remove them. absorb_break(&never_loop_block(b, main_loop_id)) @@ -2204,7 +2196,7 @@ fn is_loop(expr: &Expr) -> bool { fn is_conditional(expr: &Expr) -> bool { match expr.node { - ExprKind::If(..) | ExprKind::Match(..) => true, + ExprKind::Match(..) => true, _ => false, } } diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index 2e342ee165a3..f8cde663d899 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -1266,7 +1266,6 @@ fn lint_expect_fun_call(cx: &LateContext<'_, '_>, expr: &hir::Expr, method_span: hir::ExprKind::Call(..) | hir::ExprKind::MethodCall(..) // These variants are debatable or require further examination - | hir::ExprKind::If(..) | hir::ExprKind::Match(..) | hir::ExprKind::Block{ .. } => true, _ => false, diff --git a/clippy_lints/src/methods/unnecessary_filter_map.rs b/clippy_lints/src/methods/unnecessary_filter_map.rs index fde58b4ff7f0..a28e6fa88bbe 100644 --- a/clippy_lints/src/methods/unnecessary_filter_map.rs +++ b/clippy_lints/src/methods/unnecessary_filter_map.rs @@ -89,12 +89,6 @@ fn check_expression<'a, 'tcx: 'a>( (false, false) } }, - // There must be an else_arm or there will be a type error - hir::ExprKind::If(_, ref if_arm, Some(ref else_arm)) => { - let if_check = check_expression(cx, arg_id, if_arm); - let else_check = check_expression(cx, arg_id, else_arm); - (if_check.0 | else_check.0, if_check.1 | else_check.1) - }, hir::ExprKind::Match(_, ref arms, _) => { let mut found_mapping = false; let mut found_filtering = false; diff --git a/clippy_lints/src/utils/hir_utils.rs b/clippy_lints/src/utils/hir_utils.rs index e1ddc69f25ee..749cc294de39 100644 --- a/clippy_lints/src/utils/hir_utils.rs +++ b/clippy_lints/src/utils/hir_utils.rs @@ -493,15 +493,6 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> { let c: fn(_, _, _) -> _ = ExprKind::InlineAsm; c.hash(&mut self.s); }, - ExprKind::If(ref cond, ref t, ref e) => { - let c: fn(_, _, _) -> _ = ExprKind::If; - c.hash(&mut self.s); - self.hash_expr(cond); - self.hash_expr(&**t); - if let Some(ref e) = *e { - self.hash_expr(e); - } - }, ExprKind::Lit(ref l) => { let c: fn(_) -> _ = ExprKind::Lit; c.hash(&mut self.s); diff --git a/clippy_lints/src/utils/inspector.rs b/clippy_lints/src/utils/inspector.rs index cde911940dc1..633ebb3dd423 100644 --- a/clippy_lints/src/utils/inspector.rs +++ b/clippy_lints/src/utils/inspector.rs @@ -209,15 +209,6 @@ fn print_expr(cx: &LateContext<'_, '_>, expr: &hir::Expr, indent: usize) { print_expr(cx, e, indent + 1); println!("{}target type: {:?}", ind, target); }, - hir::ExprKind::If(ref e, _, ref els) => { - println!("{}If", ind); - println!("{}condition:", ind); - print_expr(cx, e, indent + 1); - if let Some(ref els) = *els { - println!("{}else:", ind); - print_expr(cx, els, indent + 1); - } - }, hir::ExprKind::While(ref cond, _, _) => { println!("{}While", ind); println!("{}condition:", ind); diff --git a/clippy_lints/src/utils/sugg.rs b/clippy_lints/src/utils/sugg.rs index be6e6069402e..7d029d0f61e2 100644 --- a/clippy_lints/src/utils/sugg.rs +++ b/clippy_lints/src/utils/sugg.rs @@ -94,7 +94,6 @@ impl<'a> Sugg<'a> { hir::ExprKind::AddrOf(..) | hir::ExprKind::Box(..) | hir::ExprKind::Closure(.., _) - | hir::ExprKind::If(..) | hir::ExprKind::Unary(..) | hir::ExprKind::Match(..) => Sugg::MaybeParen(snippet), hir::ExprKind::Continue(..)