aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladyslav Katasonov <[email protected]>2021-02-03 14:45:36 +0000
committerVladyslav Katasonov <[email protected]>2021-02-03 14:45:36 +0000
commit88b3034636a4f4c652e49de09a791a934573aaee (patch)
tree5de3baa15188121769f8c505b30d1d2ae9c36f44
parent1e6f13a0bee0d9600e7b582fbd9a2e1f4a9a24fc (diff)
convert IdentPat to Pat via Into
before child getter was used
-rw-r--r--crates/assists/src/handlers/extract_function.rs10
1 files changed, 5 insertions, 5 deletions
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
107 let params = param_pats 107 let params = param_pats
108 .into_iter() 108 .into_iter()
109 .map(|pat| { 109 .map(|pat| {
110 let ty = pat 110 let name = pat.name().unwrap().to_string();
111 .pat() 111
112 .and_then(|pat| ctx.sema.type_of_pat(&pat)) 112 let ty = ctx
113 .sema
114 .type_of_pat(&pat.into())
113 .and_then(|ty| ty.display_source_code(ctx.db(), module.into()).ok()) 115 .and_then(|ty| ty.display_source_code(ctx.db(), module.into()).ok())
114 .unwrap_or_else(|| "()".to_string()); 116 .unwrap_or_else(|| "()".to_string());
115 117
116 let name = pat.name().unwrap().to_string();
117
118 Param { name, ty } 118 Param { name, ty }
119 }) 119 })
120 .collect::<Vec<_>>(); 120 .collect::<Vec<_>>();