@@ -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 ) ;
@@ -160,10 +164,10 @@ impl ArithmeticSideEffects {
160164 fn manage_bin_ops < ' tcx > (
161165 & mut self ,
162166 cx : & LateContext < ' tcx > ,
163- expr : & hir:: Expr < ' tcx > ,
167+ expr : & ' tcx hir:: Expr < ' _ > ,
164168 op : & Spanned < hir:: BinOpKind > ,
165- lhs : & hir:: Expr < ' tcx > ,
166- rhs : & hir:: Expr < ' tcx > ,
169+ lhs : & ' tcx hir:: Expr < ' _ > ,
170+ rhs : & ' tcx hir:: Expr < ' _ > ,
167171 ) {
168172 if constant_simple ( cx, cx. typeck_results ( ) , expr) . is_some ( ) {
169173 return ;
@@ -236,10 +240,10 @@ impl ArithmeticSideEffects {
236240 /// provided input.
237241 fn manage_method_call < ' tcx > (
238242 & mut self ,
239- args : & [ hir:: Expr < ' tcx > ] ,
243+ args : & ' tcx [ hir:: Expr < ' _ > ] ,
240244 cx : & LateContext < ' tcx > ,
241- ps : & hir:: PathSegment < ' tcx > ,
242- receiver : & hir:: Expr < ' tcx > ,
245+ ps : & ' tcx hir:: PathSegment < ' _ > ,
246+ receiver : & ' tcx hir:: Expr < ' _ > ,
243247 ) {
244248 let Some ( arg) = args. first ( ) else {
245249 return ;
@@ -264,8 +268,8 @@ impl ArithmeticSideEffects {
264268 fn manage_unary_ops < ' tcx > (
265269 & mut self ,
266270 cx : & LateContext < ' tcx > ,
267- expr : & hir:: Expr < ' tcx > ,
268- un_expr : & hir:: Expr < ' tcx > ,
271+ expr : & ' tcx hir:: Expr < ' _ > ,
272+ un_expr : & ' tcx hir:: Expr < ' _ > ,
269273 un_op : hir:: UnOp ,
270274 ) {
271275 let hir:: UnOp :: Neg = un_op else {
@@ -287,14 +291,13 @@ impl ArithmeticSideEffects {
287291
288292 fn should_skip_expr < ' tcx > ( & mut self , cx : & LateContext < ' tcx > , expr : & hir:: Expr < ' tcx > ) -> bool {
289293 is_lint_allowed ( cx, ARITHMETIC_SIDE_EFFECTS , expr. hir_id )
290- || is_from_proc_macro ( cx, expr)
291294 || self . expr_span . is_some ( )
292295 || self . const_span . map_or ( false , |sp| sp. contains ( expr. span ) )
293296 }
294297}
295298
296299impl < ' tcx > LateLintPass < ' tcx > for ArithmeticSideEffects {
297- fn check_expr ( & mut self , cx : & LateContext < ' tcx > , expr : & hir:: Expr < ' tcx > ) {
300+ fn check_expr ( & mut self , cx : & LateContext < ' tcx > , expr : & ' tcx hir:: Expr < ' tcx > ) {
298301 if self . should_skip_expr ( cx, expr) {
299302 return ;
300303 }
0 commit comments