@@ -51,14 +51,14 @@ pub(crate) fn generate_delegate_methods(acc: &mut Assists, ctx: &AssistContext<'
51
51
Some ( field) => {
52
52
let field_name = field. name ( ) ?;
53
53
let field_ty = field. ty ( ) ?;
54
- ( format ! ( "{ field_name}" ) , field_ty, field. syntax ( ) . text_range ( ) )
54
+ ( field_name. to_string ( ) , field_ty, field. syntax ( ) . text_range ( ) )
55
55
}
56
56
None => {
57
57
let field = ctx. find_node_at_offset :: < ast:: TupleField > ( ) ?;
58
58
let field_list = ctx. find_node_at_offset :: < ast:: TupleFieldList > ( ) ?;
59
59
let field_list_index = field_list. fields ( ) . position ( |it| it == field) ?;
60
60
let field_ty = field. ty ( ) ?;
61
- ( format ! ( "{ field_list_index}" ) , field_ty, field. syntax ( ) . text_range ( ) )
61
+ ( field_list_index. to_string ( ) , field_ty, field. syntax ( ) . text_range ( ) )
62
62
}
63
63
} ;
64
64
@@ -77,13 +77,11 @@ pub(crate) fn generate_delegate_methods(acc: &mut Assists, ctx: &AssistContext<'
77
77
for method in methods {
78
78
let adt = ast:: Adt :: Struct ( strukt. clone ( ) ) ;
79
79
let name = method. name ( ctx. db ( ) ) . to_string ( ) ;
80
- let impl_def = find_struct_impl ( ctx, & adt, & name) . flatten ( ) ;
81
- let method_name = method. name ( ctx. db ( ) ) ;
82
-
80
+ let impl_def = find_struct_impl ( ctx, & adt, & [ name] ) . flatten ( ) ;
83
81
acc. add_group (
84
82
& GroupLabel ( "Generate delegate methods…" . to_owned ( ) ) ,
85
83
AssistId ( "generate_delegate_methods" , AssistKind :: Generate ) ,
86
- format ! ( "Generate delegate for `{field_name }.{method_name }()`" ) ,
84
+ format ! ( "Generate delegate for `{}.{}()`" , field_name , method . name ( ctx . db ( ) ) ) ,
87
85
target,
88
86
|builder| {
89
87
// Create the function
@@ -158,7 +156,7 @@ pub(crate) fn generate_delegate_methods(acc: &mut Assists, ctx: &AssistContext<'
158
156
}
159
157
None => {
160
158
let offset = strukt. syntax ( ) . text_range ( ) . end ( ) ;
161
- let snippet = format ! ( "\n \n {impl_def}" ) ;
159
+ let snippet = format ! ( "\n \n {}" , impl_def . syntax ( ) ) ;
162
160
builder. insert ( offset, snippet) ;
163
161
}
164
162
}
0 commit comments