@@ -6,11 +6,12 @@ use clippy_utils::diagnostics::{span_lint, span_lint_and_sugg};
66use clippy_utils:: source:: snippet_with_applicability;
77use clippy_utils:: sugg:: Sugg ;
88use 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 ,
1011} ;
1112use rustc_ast:: ast:: LitKind ;
1213use rustc_errors:: Applicability ;
13- use rustc_hir:: { BinOpKind , Block , Expr , ExprKind , HirId , Node , UnOp } ;
14+ use rustc_hir:: { BinOpKind , Expr , ExprKind , UnOp } ;
1415use rustc_lint:: { LateContext , LateLintPass } ;
1516use rustc_session:: declare_lint_pass;
1617use rustc_span:: source_map:: Spanned ;
@@ -135,13 +136,6 @@ fn condition_needs_parentheses(e: &Expr<'_>) -> bool {
135136 false
136137}
137138
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-
145139impl < ' tcx > LateLintPass < ' tcx > for NeedlessBool {
146140 fn check_expr ( & mut self , cx : & LateContext < ' tcx > , e : & ' tcx Expr < ' _ > ) {
147141 use self :: Expression :: { Bool , RetBool } ;
0 commit comments