fn fn_args(
    ctx: &AssistContext,
    target_module: hir::Module,
    call: FuncExpr,
) -> Option<(Option<ast::GenericParamList>, ast::ParamList)> {
    let mut arg_names = Vec::new();
    let mut arg_types = Vec::new();
    for arg in call.arg_list()?.args() {
        arg_names.push(match fn_arg_name(&arg) {
            Some(name) => name,
            None => String::from("arg"),
        });
        arg_types.push(match fn_arg_type(ctx, target_module, &arg) {
            Some(ty) => {
                if ty.len() > 0 && ty.starts_with('&') {
                    if let Some((new_ty, _)) = useless_type_special_case("", &ty[1..].to_owned()) {
                        new_ty
                    } else {
                        ty
                    }
                } else {
                    ty
                }
            }
            None => String::from("()"),
        });
    }
    deduplicate_arg_names(&mut arg_names);
    let params = arg_names.into_iter().zip(arg_types).map(|(name, ty)| {
        make::param(make::ext::simple_ident_pat(make::name(&name)).into(), make::ty(&ty))
    });

    Some((
        None,
        make::param_list(
            match call {
                FuncExpr::Func(_) => None,
                FuncExpr::Method(_) => Some(make::self_param()),
            },
            params,
        ),
    ))
}
/// Computes the type variables and arguments required for the generated function
Computes the type variables and arguments required for the generated function
Computes the type variables and arguments required for the generated function
fn fn_args(
    ctx: &AssistContext,
    target_module: hir::Module,
    call: FuncExpr,
) -> Option<(Option<ast::GenericParamList>, ast::ParamList)> {
    let mut arg_names = Vec::new();
    let mut arg_types = Vec::new();
    for arg in call.arg_list()?.args() {
        arg_names.push(match fn_arg_name(&arg) {
            Some(name) => name,
            None => String::from("arg"),
        });
        arg_types.push(match fn_arg_type(ctx, target_module, &arg) {
            Some(ty) => {
                if ty.len() > 0 && ty.starts_with('&') {
                    if let Some((new_ty, _)) = useless_type_special_case("", &ty[1..].to_owned()) {
                        new_ty
                    } else {
                        ty
                    }
                } else {
                    ty
                }
            }
            None => String::from("()"),
        });
    }
    deduplicate_arg_names(&mut arg_names);
    let params = arg_names.into_iter().zip(arg_types).map(|(name, ty)| {
        make::param(make::ext::simple_ident_pat(make::name(&name)).into(), make::ty(&ty))
    });
    Some((
        None,
        make::param_list(
            match call {
                FuncExpr::Func(_) => None,
                FuncExpr::Method(_) => Some(make::self_param()),
            },
            params,
        ),
    ))
}
fn fn_args ( ctx : & AssistContext , target_module : hir :: Module , call : FuncExpr , ) -> Option < ( Option < ast :: GenericParamList > , ast :: ParamList ) > { let mut arg_names = Vec :: new ( ) ; let mut arg_types = Vec :: new ( ) ; for arg in call . arg_list ( ) ? . args ( ) { arg_names . push ( match fn_arg_name ( & arg ) { Some ( name ) => name , None => String :: from ( " " ) , } ) ; arg_types . push ( match fn_arg_type ( ctx , target_module , & arg ) { Some ( ty ) => { if ty . len ( ) > 0 && ty . starts_with ( '&' ) { if let Some ( ( new_ty , _ ) ) = useless_type_special_case ( " " , & ty [ 1 .. ] . to_owned ( ) ) { new_ty } else { ty } } else { ty } } None => String :: from ( " " ) , } ) ; } deduplicate_arg_names ( & mut arg_names ) ; let params = arg_names . into_iter ( ) . zip ( arg_types ) . map ( | ( name , ty ) | { make :: param ( make :: ext :: simple_ident_pat ( make :: name ( & name ) ) . into ( ) , make :: ty ( & ty ) ) } ) ; Some ( ( None , make :: param_list ( match call { FuncExpr :: Func ( _ ) => None , FuncExpr :: Method ( _ ) => Some ( make :: self_param ( ) ) , } , params , ) , ) ) }
Computes the type variables and arguments required for the generated function
Computes the type variables and arguments required for the generated function
ctx
&AssistContext
target_module
hir::Module
call
FuncExpr