diff options
author | Vladyslav Katasonov <[email protected]> | 2021-02-03 14:45:36 +0000 |
---|---|---|
committer | Vladyslav Katasonov <[email protected]> | 2021-02-03 14:45:36 +0000 |
commit | 88b3034636a4f4c652e49de09a791a934573aaee (patch) | |
tree | 5de3baa15188121769f8c505b30d1d2ae9c36f44 /crates/assists/src/handlers/extract_function.rs | |
parent | 1e6f13a0bee0d9600e7b582fbd9a2e1f4a9a24fc (diff) |
convert IdentPat to Pat via Into
before child getter was used
Diffstat (limited to 'crates/assists/src/handlers/extract_function.rs')
-rw-r--r-- | crates/assists/src/handlers/extract_function.rs | 10 |
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<_>>(); |