@@ -42,9 +42,9 @@ impl ArithmeticSideEffects {
4242 }
4343 }
4444
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
4646 /// 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 {
4848 if let hir:: BinOpKind :: Add | hir:: BinOpKind :: Sub = op. node
4949 && let hir:: ExprKind :: Lit ( ref lit) = expr. kind
5050 && let ast:: LitKind :: Int ( 0 , _) = lit. node
@@ -124,8 +124,8 @@ impl ArithmeticSideEffects {
124124 Self :: is_literal_integer ( rhs, cx. typeck_results ( ) . expr_ty ( rhs) . peel_refs ( ) ) ,
125125 ) {
126126 ( 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) ,
129129 ( false , false ) => false ,
130130 } ;
131131 if !has_valid_op {
0 commit comments