convert IdentPat to Pat via Into

before child getter was used
This commit is contained in:
Vladyslav Katasonov 2021-02-03 17:45:36 +03:00
parent 1e6f13a0be
commit 88b3034636

View File

@ -107,14 +107,14 @@ pub(crate) fn extract_function(acc: &mut Assists, ctx: &AssistContext) -> Option
let params = param_pats
.into_iter()
.map(|pat| {
let ty = pat
.pat()
.and_then(|pat| ctx.sema.type_of_pat(&pat))
let name = pat.name().unwrap().to_string();
let ty = ctx
.sema
.type_of_pat(&pat.into())
.and_then(|ty| ty.display_source_code(ctx.db(), module.into()).ok())
.unwrap_or_else(|| "()".to_string());
let name = pat.name().unwrap().to_string();
Param { name, ty }
})
.collect::<Vec<_>>();