Function expr_requires_coercion

Source
pub fn expr_requires_coercion<'tcx>(
    cx: &LateContext<'tcx>,
    expr: &Expr<'tcx>,
) -> bool
Expand description

Returns true if the specified expr requires coercion, meaning that it either has a coercion or propagates a coercion from one of its sub expressions.

Similar to is_adjusted, this not only checks if an expression’s type was adjusted, but also going through extra steps to see if it fits the description of coercion sites.

You should used this when you want to avoid suggesting replacing an expression that is currently a coercion site or coercion propagating expression with one that is not.