fn make_return_type(
    ctx: &AssistContext,
    call: &ast::Expr,
    target_module: Module,
) -> (Option<ast::RetType>, bool) {
    let (ret_ty, should_focus_return_type) = {
        match ctx.sema.type_of_expr(call).map(TypeInfo::original) {
            Some(ty) if ty.is_unknown() => (Some(make::ty_unit()), true),
            None => (Some(make::ty_unit()), true),
            Some(ty) if ty.is_unit() => (None, false),
            Some(ty) => {
                let rendered = ty.display_source_code(ctx.db(), target_module.into());
                match rendered {
                    Ok(rendered) => (Some(make::ty(&rendered)), false),
                    Err(_) => (Some(make::ty_unit()), true),
                }
            }
        }
    };
    let ret_type = ret_ty.map(|rt| make::ret_type(rt));
    (ret_type, should_focus_return_type)
}
/// Makes an optional return type along with whether the return type should be focused by the cursor.
/// If we cannot infer what the return type should be, we create unit as a placeholder.
///
/// The rule for whether we focus a return type or not (and thus focus the function body),
/// is rather simple:
/// * If we could *not* infer what the return type should be, focus it (so the user can fill-in
/// the correct return type).
/// * If we could infer the return type, don't focus it (and thus focus the function body) so the
/// user can change the `todo!` function body.
Makes an optional return type along with whether the return type should be focused by the cursor.
If we cannot infer what the return type should be, we create unit as a placeholder.

The rule for whether we focus a return type or not (and thus focus the function body),
is rather simple:
If we could *not* infer what the return type should be, focus it (so the user can fill-in
the correct return type).
If we could infer the return type, don't focus it (and thus focus the function body) so the
user can change the `todo!` function body.
Makes an optional return type along with whether the return type should be focused by the cursor . If we cannot infer what the return type should be we create unit as a placeholder . The rule for whether we focus a return type or not ( and thus focus the function body ) is rather simple : If we could * not * infer what the return type should be focus it ( so the user can fill - in the correct return type ) . If we could infer the return type don ' t focus it ( and thus focus the function body ) so the user can change the ` todo! ` function body .
fn make_return_type(
    ctx: &AssistContext,
    call: &ast::Expr,
    target_module: Module,
) -> (Option<ast::RetType>, bool) {
    let (ret_ty, should_focus_return_type) = {
        match ctx.sema.type_of_expr(call).map(TypeInfo::original) {
            Some(ty) if ty.is_unknown() => (Some(make::ty_unit()), true),
            None => (Some(make::ty_unit()), true),
            Some(ty) if ty.is_unit() => (None, false),
            Some(ty) => {
                let rendered = ty.display_source_code(ctx.db(), target_module.into());
                match rendered {
                    Ok(rendered) => (Some(make::ty(&rendered)), false),
                    Err(_) => (Some(make::ty_unit()), true),
                }
            }
        }
    };
    let ret_type = ret_ty.map(|rt| make::ret_type(rt));
    (ret_type, should_focus_return_type)
}
fn make_return_type ( ctx : & AssistContext , call : & ast :: Expr , target_module : Module , ) -> ( Option < ast :: RetType > , bool ) { let ( ret_ty , should_focus_return_type ) = { match ctx . sema . type_of_expr ( call ) . map ( TypeInfo :: original ) { Some ( ty ) if ty . is_unknown ( ) => ( Some ( make :: ty_unit ( ) ) , true ) , None => ( Some ( make :: ty_unit ( ) ) , true ) , Some ( ty ) if ty . is_unit ( ) => ( None , false ) , Some ( ty ) => { let rendered = ty . display_source_code ( ctx . db ( ) , target_module . into ( ) ) ; match rendered { Ok ( rendered ) => ( Some ( make :: ty ( & rendered ) ) , false ) , Err ( _ ) => ( Some ( make :: ty_unit ( ) ) , true ) , } } } } ; let ret_type = ret_ty . map ( | rt | make :: ret_type ( rt ) ) ; ( ret_type , should_focus_return_type ) }
Makes an optional return type along with whether the return type should be focused by the cursor.
Makes an optional return type along with whether the return type should be focused by the cursor .
ctx
&AssistContext
call
&ast::Expr
target_module
Module