diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-09-18 15:30:07 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-09-21 09:00:22 +0000 |
| commit | 238dc2828ed4b2ce49a95b8093486cd01c528af9 (patch) | |
| tree | 0f7f4d0cb8394e884347183d8edb13eb60ec98cd | |
| parent | b30cefc775e92892f8d49a649bb09510bbbb79af (diff) | |
| download | rust-238dc2828ed4b2ce49a95b8093486cd01c528af9.tar.gz rust-238dc2828ed4b2ce49a95b8093486cd01c528af9.zip | |
Prevent promotion of const fn calls in inline consts
| -rw-r--r-- | clippy_lints/src/operators/arithmetic_side_effects.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/operators/numeric_arithmetic.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/clippy_lints/src/operators/arithmetic_side_effects.rs b/clippy_lints/src/operators/arithmetic_side_effects.rs index 8072aded851..a10aa65e594 100644 --- a/clippy_lints/src/operators/arithmetic_side_effects.rs +++ b/clippy_lints/src/operators/arithmetic_side_effects.rs @@ -315,7 +315,7 @@ impl<'tcx> LateLintPass<'tcx> for ArithmeticSideEffects { let body_owner_def_id = cx.tcx.hir().body_owner_def_id(body.id()); let body_owner_kind = cx.tcx.hir().body_owner_kind(body_owner_def_id); - if let hir::BodyOwnerKind::Const | hir::BodyOwnerKind::Static(_) = body_owner_kind { + if let hir::BodyOwnerKind::Const { .. } | hir::BodyOwnerKind::Static(_) = body_owner_kind { let body_span = cx.tcx.hir().span_with_body(body_owner); if let Some(span) = self.const_span && span.contains(body_span) { return; diff --git a/clippy_lints/src/operators/numeric_arithmetic.rs b/clippy_lints/src/operators/numeric_arithmetic.rs index 102845ceed0..80389cbf84b 100644 --- a/clippy_lints/src/operators/numeric_arithmetic.rs +++ b/clippy_lints/src/operators/numeric_arithmetic.rs @@ -72,7 +72,7 @@ impl Context { let body_owner_def_id = cx.tcx.hir().body_owner_def_id(body.id()); match cx.tcx.hir().body_owner_kind(body_owner_def_id) { - hir::BodyOwnerKind::Static(_) | hir::BodyOwnerKind::Const => { + hir::BodyOwnerKind::Static(_) | hir::BodyOwnerKind::Const { .. } => { let body_span = cx.tcx.hir().span_with_body(body_owner); if let Some(span) = self.const_span { |
