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