File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
clippy_lints/src/operators Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -34,14 +34,10 @@ pub(super) fn check<'tcx>(
3434}
3535
3636fn used_in_comparison_with_zero ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) -> bool {
37- let Node :: Expr ( parent_expr) = cx. tcx . parent_hir_node ( expr. hir_id ) else {
38- return false ;
39- } ;
40- let ExprKind :: Binary ( op, lhs, rhs) = parent_expr. kind else {
41- return false ;
42- } ;
43-
44- if let BinOpKind :: Eq | BinOpKind :: Ne = op. node {
37+ if let Node :: Expr ( parent_expr) = cx. tcx . parent_hir_node ( expr. hir_id )
38+ && let ExprKind :: Binary ( op, lhs, rhs) = parent_expr. kind
39+ && let BinOpKind :: Eq | BinOpKind :: Ne = op. node
40+ {
4541 let ecx = ConstEvalCtxt :: new ( cx) ;
4642 matches ! ( ecx. eval( lhs) , Some ( Constant :: Int ( 0 ) ) ) || matches ! ( ecx. eval( rhs) , Some ( Constant :: Int ( 0 ) ) )
4743 } else {
You can’t perform that action at this time.
0 commit comments