fn scope_for_fn_insertion(body: &FunctionBody, anchor: Anchor) -> Option<SyntaxNode> {
    match body {
        FunctionBody::Expr(e) => scope_for_fn_insertion_node(e.syntax(), anchor),
        FunctionBody::Span { elements, .. } => {
            let node = elements.iter().find_map(|e| e.as_node())?;
            scope_for_fn_insertion_node(&node, anchor)
        }
    }
}
/// find where to put extracted function definition
///
/// Function should be put right after returned node
find where to put extracted function definition
Function should be put right after returned node
find where to put extracted function definition Function should be put right after returned node
fn scope_for_fn_insertion(body: &FunctionBody, anchor: Anchor) -> Option<SyntaxNode> {
    match body {
        FunctionBody::Expr(e) => scope_for_fn_insertion_node(e.syntax(), anchor),
        FunctionBody::Span { elements, .. } => {
            let node = elements.iter().find_map(|e| e.as_node())?;
            scope_for_fn_insertion_node(&node, anchor)
        }
    }
}
fn scope_for_fn_insertion ( body : & FunctionBody , anchor : Anchor ) -> Option < SyntaxNode > { match body { FunctionBody :: Expr ( e ) => scope_for_fn_insertion_node ( e . syntax ( ) , anchor ) , FunctionBody :: Span { elements , .. } => { let node = elements . iter ( ) . find_map ( | e | e . as_node ( ) ) ? ; scope_for_fn_insertion_node ( & node , anchor ) } } }
find where to put extracted function definition
Function should be put right after returned node
find where to put extracted function definition Function should be put right after returned node
body
&FunctionBody
anchor
Anchor
body
&FunctionBody
anchor
Anchor