@@ -132,7 +132,11 @@ impl ArithmeticSideEffects {
132132 }
133133
134134 // Common entry-point to avoid code duplication.
135- fn issue_lint ( & mut self , cx : & LateContext < ' _ > , expr : & hir:: Expr < ' _ > ) {
135+ fn issue_lint < ' tcx > ( & mut self , cx : & LateContext < ' tcx > , expr : & ' tcx hir:: Expr < ' _ > ) {
136+ if is_from_proc_macro ( cx, expr) {
137+ return ;
138+ }
139+
136140 let msg = "arithmetic operation that can potentially result in unexpected side-effects" ;
137141 span_lint ( cx, ARITHMETIC_SIDE_EFFECTS , expr. span , msg) ;
138142 self . expr_span = Some ( expr. span ) ;
@@ -158,10 +162,10 @@ impl ArithmeticSideEffects {
158162 fn manage_bin_ops < ' tcx > (
159163 & mut self ,
160164 cx : & LateContext < ' tcx > ,
161- expr : & hir:: Expr < ' tcx > ,
165+ expr : & ' tcx hir:: Expr < ' _ > ,
162166 op : & Spanned < hir:: BinOpKind > ,
163- lhs : & hir:: Expr < ' tcx > ,
164- rhs : & hir:: Expr < ' tcx > ,
167+ lhs : & ' tcx hir:: Expr < ' _ > ,
168+ rhs : & ' tcx hir:: Expr < ' _ > ,
165169 ) {
166170 if constant_simple ( cx, cx. typeck_results ( ) , expr) . is_some ( ) {
167171 return ;
@@ -234,10 +238,10 @@ impl ArithmeticSideEffects {
234238 /// provided input.
235239 fn manage_method_call < ' tcx > (
236240 & mut self ,
237- args : & [ hir:: Expr < ' tcx > ] ,
241+ args : & ' tcx [ hir:: Expr < ' _ > ] ,
238242 cx : & LateContext < ' tcx > ,
239- ps : & hir:: PathSegment < ' tcx > ,
240- receiver : & hir:: Expr < ' tcx > ,
243+ ps : & ' tcx hir:: PathSegment < ' _ > ,
244+ receiver : & ' tcx hir:: Expr < ' _ > ,
241245 ) {
242246 let Some ( arg) = args. first ( ) else {
243247 return ;
@@ -262,8 +266,8 @@ impl ArithmeticSideEffects {
262266 fn manage_unary_ops < ' tcx > (
263267 & mut self ,
264268 cx : & LateContext < ' tcx > ,
265- expr : & hir:: Expr < ' tcx > ,
266- un_expr : & hir:: Expr < ' tcx > ,
269+ expr : & ' tcx hir:: Expr < ' _ > ,
270+ un_expr : & ' tcx hir:: Expr < ' _ > ,
267271 un_op : hir:: UnOp ,
268272 ) {
269273 let hir:: UnOp :: Neg = un_op else {
@@ -285,14 +289,13 @@ impl ArithmeticSideEffects {
285289
286290 fn should_skip_expr < ' tcx > ( & mut self , cx : & LateContext < ' tcx > , expr : & hir:: Expr < ' tcx > ) -> bool {
287291 is_lint_allowed ( cx, ARITHMETIC_SIDE_EFFECTS , expr. hir_id )
288- || is_from_proc_macro ( cx, expr)
289292 || self . expr_span . is_some ( )
290293 || self . const_span . map_or ( false , |sp| sp. contains ( expr. span ) )
291294 }
292295}
293296
294297impl < ' tcx > LateLintPass < ' tcx > for ArithmeticSideEffects {
295- fn check_expr ( & mut self , cx : & LateContext < ' tcx > , expr : & hir:: Expr < ' tcx > ) {
298+ fn check_expr ( & mut self , cx : & LateContext < ' tcx > , expr : & ' tcx hir:: Expr < ' tcx > ) {
296299 if self . should_skip_expr ( cx, expr) {
297300 return ;
298301 }
0 commit comments