Skip to content

Commit 238dc28

Browse files
committed
Prevent promotion of const fn calls in inline consts
1 parent b30cefc commit 238dc28

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

clippy_lints/src/operators/arithmetic_side_effects.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ impl<'tcx> LateLintPass<'tcx> for ArithmeticSideEffects {
315315
let body_owner_def_id = cx.tcx.hir().body_owner_def_id(body.id());
316316

317317
let body_owner_kind = cx.tcx.hir().body_owner_kind(body_owner_def_id);
318-
if let hir::BodyOwnerKind::Const | hir::BodyOwnerKind::Static(_) = body_owner_kind {
318+
if let hir::BodyOwnerKind::Const { .. } | hir::BodyOwnerKind::Static(_) = body_owner_kind {
319319
let body_span = cx.tcx.hir().span_with_body(body_owner);
320320
if let Some(span) = self.const_span && span.contains(body_span) {
321321
return;

clippy_lints/src/operators/numeric_arithmetic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl Context {
7272
let body_owner_def_id = cx.tcx.hir().body_owner_def_id(body.id());
7373

7474
match cx.tcx.hir().body_owner_kind(body_owner_def_id) {
75-
hir::BodyOwnerKind::Static(_) | hir::BodyOwnerKind::Const => {
75+
hir::BodyOwnerKind::Static(_) | hir::BodyOwnerKind::Const { .. } => {
7676
let body_span = cx.tcx.hir().span_with_body(body_owner);
7777

7878
if let Some(span) = self.const_span {

0 commit comments

Comments
 (0)