Skip to content

Commit 6dff6d0

Browse files
committed
don't lint on if let
1 parent 6b89e6a commit 6dff6d0

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

clippy_lints/src/needless_if.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
use clippy_utils::{diagnostics::span_lint_and_sugg, is_from_proc_macro, source::snippet_with_applicability};
22
use rustc_errors::Applicability;
3-
use rustc_hir::{Expr, ExprKind, Node, intravisit::{Visitor, walk_expr}};
3+
use rustc_hir::{
4+
intravisit::{walk_expr, Visitor},
5+
Expr, ExprKind, Node,
6+
};
47
use rustc_lint::{LateContext, LateLintPass, LintContext};
58
use rustc_middle::lint::in_external_macro;
69
use rustc_session::{declare_lint_pass, declare_tool_lint};

tests/ui/needless_if.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ fn main() {
4848
if let true = true {}
4949
if let true = true && true {}
5050
if true && let true = true {}
51-
if { if let true = true && true { true } else { false } } && true {}
51+
if {
52+
if let true = true && true { true } else { false }
53+
} && true
54+
{}
5255
external! { if (true) {} }
5356
with_span! {
5457
span

0 commit comments

Comments
 (0)