pub(crate) fn is_body_identity_function<'hir>(
cx: &LateContext<'_>,
func: &Body<'hir>,
) -> boolExpand description
Checks if a function’s body represents the identity function. Looks for bodies of the form:
|x| x|x| return x|x| { return x }|x| { return x; }|(x, y)| (x, y)|[x, y]| [x, y]|Foo(bar, baz)| Foo(bar, baz)|Foo { bar, baz }| Foo { bar, baz }|x| { let y = x; ...; let z = y; z }|x| { let y = x; ...; let z = y; return z }
Consider calling is_expr_untyped_identity_function or is_expr_identity_function instead.