pub fn potential_return_of_enclosing_body(
cx: &LateContext<'_>,
expr: &Expr<'_>,
) -> boolExpand description
Checks if expr may be directly used as the return value of its enclosing body.
The following cases are covered:
expras the last expression of the body, or of a block that can be used as the return valuereturn expr- then or else part of a
ifin return position - arm body of a
matchin a return position break exprorbreak 'label exprif the loop or block being exited is used as a return value
Contrary to TyCtxt::hir_get_fn_id_for_return_block(), if expr is part of a
larger expression, for example a field expression of a struct, it will not be
considered as matching the condition and will return false.
Also, even if expr is assigned to a variable which is later returned, this function
will still return false because expr is not used directly as the return value
as it goes through the intermediate variable.