Skip to content

Commit

Permalink
Auto merge of #15429 - alibektas:deunwrap/generate_delegate_methods, …
Browse files Browse the repository at this point in the history
…r=Veykril

minor : Deunwrap generate_delegate_methods

#15398 subtask 8
  • Loading branch information
bors committed Aug 15, 2023
2 parents 0b2a241 + c81a068 commit c18ce9a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions crates/ide-assists/src/handlers/generate_delegate_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ pub(crate) fn generate_delegate_methods(acc: &mut Assists, ctx: &AssistContext<'
let Some(impl_def) = find_struct_impl(ctx, &adt, std::slice::from_ref(&name)) else {
continue;
};

let field = make::ext::field_from_idents(["self", &field_name])?;

acc.add_group(
&GroupLabel("Generate delegate methods…".to_owned()),
AssistId("generate_delegate_methods", AssistKind::Generate),
Expand All @@ -115,11 +118,7 @@ pub(crate) fn generate_delegate_methods(acc: &mut Assists, ctx: &AssistContext<'
Some(list) => convert_param_list_to_arg_list(list),
None => make::arg_list([]),
};
let tail_expr = make::expr_method_call(
make::ext::field_from_idents(["self", &field_name]).unwrap(), // This unwrap is ok because we have at least 1 arg in the list
make::name_ref(&name),
arg_list,
);
let tail_expr = make::expr_method_call(field, make::name_ref(&name), arg_list);
let ret_type = method_source.ret_type();
let is_async = method_source.async_token().is_some();
let is_const = method_source.const_token().is_some();
Expand Down

0 comments on commit c18ce9a

Please sign in to comment.