From 88b3034636a4f4c652e49de09a791a934573aaee Mon Sep 17 00:00:00 2001 From: Vladyslav Katasonov Date: Wed, 3 Feb 2021 17:45:36 +0300 Subject: convert IdentPat to Pat via Into before child getter was used --- crates/assists/src/handlers/extract_function.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/assists') diff --git a/crates/assists/src/handlers/extract_function.rs b/crates/assists/src/handlers/extract_function.rs index 09c2a9bc7..218529fcf 100644 --- a/crates/assists/src/handlers/extract_function.rs +++ b/crates/assists/src/handlers/extract_function.rs @@ -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::>(); -- cgit v1.2.3