@@ -42,9 +42,9 @@ impl ArithmeticSideEffects {
42
42
}
43
43
}
44
44
45
- /// Assuming that `expr` is a literal integer, checks assign operators (+=, -=, *= , /= ) in a
45
+ /// Assuming that `expr` is a literal integer, checks operators (+=, -=, *, /) in a
46
46
/// non-constant environment that won't overflow.
47
- fn has_valid_assign_op ( op : & Spanned < hir:: BinOpKind > , expr : & hir:: Expr < ' _ > ) -> bool {
47
+ fn has_valid_op ( op : & Spanned < hir:: BinOpKind > , expr : & hir:: Expr < ' _ > ) -> bool {
48
48
if let hir:: BinOpKind :: Add | hir:: BinOpKind :: Sub = op. node
49
49
&& let hir:: ExprKind :: Lit ( ref lit) = expr. kind
50
50
&& let ast:: LitKind :: Int ( 0 , _) = lit. node
@@ -124,8 +124,8 @@ impl ArithmeticSideEffects {
124
124
Self :: is_literal_integer ( rhs, cx. typeck_results ( ) . expr_ty ( rhs) . peel_refs ( ) ) ,
125
125
) {
126
126
( true , true ) => true ,
127
- ( true , false ) => Self :: has_valid_assign_op ( op, lhs) ,
128
- ( false , true ) => Self :: has_valid_assign_op ( op, rhs) ,
127
+ ( true , false ) => Self :: has_valid_op ( op, lhs) ,
128
+ ( false , true ) => Self :: has_valid_op ( op, rhs) ,
129
129
( false , false ) => false ,
130
130
} ;
131
131
if !has_valid_op {
0 commit comments