@@ -33,14 +33,8 @@ declare_clippy_lint! {
3333declare_lint_pass ! ( DecimalBitMask => [ DECIMAL_BIT_MASK ] ) ;
3434
3535fn check_bitwise_binary_expr ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) {
36- if let ExprKind :: Binary (
37- Spanned {
38- node : BinOpKind :: BitAnd | BinOpKind :: BitOr | BinOpKind :: BitXor ,
39- ..
40- } ,
41- left,
42- right,
43- ) = & expr. kind
36+ if let ExprKind :: Binary ( op, left, right) = & expr. kind
37+ && matches ! ( op. node, BinOpKind :: BitAnd | BinOpKind :: BitOr | BinOpKind :: BitXor )
4438 {
4539 for expr in [ left, right] {
4640 if let ExprKind :: Lit ( lit) = & expr. kind
@@ -54,19 +48,14 @@ fn check_bitwise_binary_expr(cx: &LateContext<'_>, expr: &Expr<'_>) {
5448}
5549
5650fn check_bitwise_assign_expr ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) {
57- if let ExprKind :: AssignOp (
58- Spanned {
59- node : AssignOpKind :: BitAndAssign | AssignOpKind :: BitOrAssign | AssignOpKind :: BitXorAssign ,
60- ..
61- } ,
62- _,
63- Expr {
64- kind : ExprKind :: Lit ( lit) ,
65- ..
66- } ,
67- ) = & expr. kind
51+ if let ExprKind :: AssignOp ( op, _, e) = & expr. kind
52+ && matches ! (
53+ op. node,
54+ AssignOpKind :: BitAndAssign | AssignOpKind :: BitOrAssign | AssignOpKind :: BitXorAssign
55+ )
56+ && let ExprKind :: Lit ( lit) = e. kind
6857 && is_decimal_number ( cx, lit. span )
69- && !is_power_of_twoish ( lit)
58+ && !is_power_of_twoish ( & lit)
7059 {
7160 emit_lint ( cx, lit. span ) ;
7261 }
0 commit comments