pub fn in_constant(cx: &LateContext<'_>, id: HirId) -> bool
Returns true if the given HirId is inside a constant context.
true
HirId
This is the same as is_inside_always_const_context, but also includes const fn.
is_inside_always_const_context
const fn
if in_constant(cx, expr.hir_id) { // Do something }