Skip to content

Commit 02f5b5e

Browse files
committed
method generation assist: store owned ast nodes
1 parent 6240b2d commit 02f5b5e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

crates/ide_assists/src/handlers/generate_function.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ use crate::{
1717
AssistContext, AssistId, AssistKind, Assists,
1818
};
1919

20-
enum FuncExpr<'a> {
21-
Func(&'a ast::CallExpr),
22-
Method(&'a ast::MethodCallExpr),
20+
enum FuncExpr {
21+
Func(ast::CallExpr),
22+
Method(ast::MethodCallExpr),
2323
}
2424

25-
impl<'a> FuncExpr<'a> {
25+
impl FuncExpr {
2626
fn arg_list(&self) -> Option<ArgList> {
27-
match *self {
27+
match self {
2828
FuncExpr::Func(fn_call) => fn_call.arg_list(),
2929
FuncExpr::Method(m_call) => m_call.arg_list(),
3030
}
3131
}
3232

3333
fn syntax(&self) -> &SyntaxNode {
34-
match *self {
34+
match self {
3535
FuncExpr::Func(fn_call) => fn_call.syntax(),
3636
FuncExpr::Method(m_call) => m_call.syntax(),
3737
}
@@ -212,12 +212,12 @@ impl FunctionBuilder {
212212
file = in_file;
213213
target
214214
}
215-
None => next_space_for_fn_after_call_site(FuncExpr::Func(call))?,
215+
None => next_space_for_fn_after_call_site(FuncExpr::Func(call.clone()))?,
216216
};
217217
let needs_pub = target_module.is_some();
218218
let target_module = target_module.or_else(|| ctx.sema.scope(target.syntax()).module())?;
219219
let fn_name = fn_name(path)?;
220-
let (type_params, params) = fn_args(ctx, target_module, FuncExpr::Func(call))?;
220+
let (type_params, params) = fn_args(ctx, target_module, FuncExpr::Func(call.clone()))?;
221221

222222
let await_expr = call.syntax().parent().and_then(ast::AwaitExpr::cast);
223223
let is_async = await_expr.is_some();
@@ -287,7 +287,7 @@ impl FunctionBuilder {
287287
let needs_pub = !module_is_descendant(&current_module, &target_module, ctx);
288288

289289
let fn_name = make::name(&name.text());
290-
let (type_params, params) = fn_args(ctx, target_module, FuncExpr::Method(call))?;
290+
let (type_params, params) = fn_args(ctx, target_module, FuncExpr::Method(call.clone()))?;
291291

292292
let await_expr = call.syntax().parent().and_then(ast::AwaitExpr::cast);
293293
let is_async = await_expr.is_some();

0 commit comments

Comments
 (0)