@@ -132,7 +132,11 @@ impl ArithmeticSideEffects {
132
132
}
133
133
134
134
// 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
+
136
140
let msg = "arithmetic operation that can potentially result in unexpected side-effects" ;
137
141
span_lint ( cx, ARITHMETIC_SIDE_EFFECTS , expr. span , msg) ;
138
142
self . expr_span = Some ( expr. span ) ;
@@ -158,10 +162,10 @@ impl ArithmeticSideEffects {
158
162
fn manage_bin_ops < ' tcx > (
159
163
& mut self ,
160
164
cx : & LateContext < ' tcx > ,
161
- expr : & hir:: Expr < ' tcx > ,
165
+ expr : & ' tcx hir:: Expr < ' _ > ,
162
166
op : & Spanned < hir:: BinOpKind > ,
163
- lhs : & hir:: Expr < ' tcx > ,
164
- rhs : & hir:: Expr < ' tcx > ,
167
+ lhs : & ' tcx hir:: Expr < ' _ > ,
168
+ rhs : & ' tcx hir:: Expr < ' _ > ,
165
169
) {
166
170
if constant_simple ( cx, cx. typeck_results ( ) , expr) . is_some ( ) {
167
171
return ;
@@ -234,10 +238,10 @@ impl ArithmeticSideEffects {
234
238
/// provided input.
235
239
fn manage_method_call < ' tcx > (
236
240
& mut self ,
237
- args : & [ hir:: Expr < ' tcx > ] ,
241
+ args : & ' tcx [ hir:: Expr < ' _ > ] ,
238
242
cx : & LateContext < ' tcx > ,
239
- ps : & hir:: PathSegment < ' tcx > ,
240
- receiver : & hir:: Expr < ' tcx > ,
243
+ ps : & ' tcx hir:: PathSegment < ' _ > ,
244
+ receiver : & ' tcx hir:: Expr < ' _ > ,
241
245
) {
242
246
let Some ( arg) = args. first ( ) else {
243
247
return ;
@@ -262,8 +266,8 @@ impl ArithmeticSideEffects {
262
266
fn manage_unary_ops < ' tcx > (
263
267
& mut self ,
264
268
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 < ' _ > ,
267
271
un_op : hir:: UnOp ,
268
272
) {
269
273
let hir:: UnOp :: Neg = un_op else {
@@ -285,14 +289,13 @@ impl ArithmeticSideEffects {
285
289
286
290
fn should_skip_expr < ' tcx > ( & mut self , cx : & LateContext < ' tcx > , expr : & hir:: Expr < ' tcx > ) -> bool {
287
291
is_lint_allowed ( cx, ARITHMETIC_SIDE_EFFECTS , expr. hir_id )
288
- || is_from_proc_macro ( cx, expr)
289
292
|| self . expr_span . is_some ( )
290
293
|| self . const_span . map_or ( false , |sp| sp. contains ( expr. span ) )
291
294
}
292
295
}
293
296
294
297
impl < ' 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 > ) {
296
299
if self . should_skip_expr ( cx, expr) {
297
300
return ;
298
301
}
0 commit comments