@@ -6,11 +6,12 @@ use clippy_utils::diagnostics::{span_lint, span_lint_and_sugg};
6
6
use clippy_utils:: source:: snippet_with_applicability;
7
7
use clippy_utils:: sugg:: Sugg ;
8
8
use clippy_utils:: {
9
- higher, is_else_clause, is_expn_of, peel_blocks, peel_blocks_with_stmt, span_extract_comment, SpanlessEq ,
9
+ higher, is_else_clause, is_expn_of, is_parent_stmt, peel_blocks, peel_blocks_with_stmt, span_extract_comment,
10
+ SpanlessEq ,
10
11
} ;
11
12
use rustc_ast:: ast:: LitKind ;
12
13
use rustc_errors:: Applicability ;
13
- use rustc_hir:: { BinOpKind , Block , Expr , ExprKind , HirId , Node , UnOp } ;
14
+ use rustc_hir:: { BinOpKind , Expr , ExprKind , UnOp } ;
14
15
use rustc_lint:: { LateContext , LateLintPass } ;
15
16
use rustc_session:: declare_lint_pass;
16
17
use rustc_span:: source_map:: Spanned ;
@@ -135,13 +136,6 @@ fn condition_needs_parentheses(e: &Expr<'_>) -> bool {
135
136
false
136
137
}
137
138
138
- fn is_parent_stmt ( cx : & LateContext < ' _ > , id : HirId ) -> bool {
139
- matches ! (
140
- cx. tcx. parent_hir_node( id) ,
141
- Node :: Stmt ( ..) | Node :: Block ( Block { stmts: & [ ] , .. } )
142
- )
143
- }
144
-
145
139
impl < ' tcx > LateLintPass < ' tcx > for NeedlessBool {
146
140
fn check_expr ( & mut self , cx : & LateContext < ' tcx > , e : & ' tcx Expr < ' _ > ) {
147
141
use self :: Expression :: { Bool , RetBool } ;
0 commit comments