@@ -86,6 +86,18 @@ struct TargetInfo {
8686 insert_offset : TextSize ,
8787}
8888
89+ impl TargetInfo {
90+ fn new (
91+ target_module : Option < Module > ,
92+ adt_name : Option < hir:: Name > ,
93+ target : GeneratedFunctionTarget ,
94+ file : FileId ,
95+ insert_offset : TextSize ,
96+ ) -> Self {
97+ Self { target_module, adt_name, target, file, insert_offset }
98+ }
99+ }
100+
89101fn fn_target_info (
90102 ctx : & AssistContext < ' _ > ,
91103 path : ast:: Path ,
@@ -123,7 +135,7 @@ fn fn_target_info(
123135 get_fn_target ( ctx, & target_module, call. clone ( ) ) ?
124136 }
125137 } ;
126- Some ( TargetInfo { target_module, adt_name, target, file, insert_offset } )
138+ Some ( TargetInfo :: new ( target_module, adt_name, target, file, insert_offset) )
127139}
128140
129141fn gen_method ( acc : & mut Assists , ctx : & AssistContext < ' _ > ) -> Option < ( ) > {
@@ -427,7 +439,7 @@ fn assoc_fn_target_info(
427439 let ( impl_, file) = get_adt_source ( ctx, & adt, fn_name) ?;
428440 let ( target, insert_offset) = get_method_target ( ctx, & module, & impl_) ?;
429441 let adt_name = if impl_. is_none ( ) { Some ( adt. name ( ctx. sema . db ) ) } else { None } ;
430- Some ( TargetInfo { target_module, adt_name, target, file, insert_offset } )
442+ Some ( TargetInfo :: new ( target_module, adt_name, target, file, insert_offset) )
431443}
432444
433445fn get_insert_offset ( target : & GeneratedFunctionTarget ) -> TextSize {
0 commit comments