@@ -34,16 +34,7 @@ use salsa::Database;
3434
3535use crate :: documentable_item:: DocumentableItemId ;
3636use crate :: location_links:: { LocationLink , format_signature} ;
37- use crate :: signature_data:: {
38- DocumentableItemSignatureData , get_constant_signature_data, get_enum_signature_data,
39- get_extern_function_full_signature, get_extern_type_full_signature,
40- get_free_function_signature_data, get_impl_alias_signature_data,
41- get_impl_constant_signature_data, get_impl_def_signature_data,
42- get_impl_function_signature_data, get_impl_type_def_full_signature, get_member_signature_data,
43- get_module_type_alias_full_signature, get_struct_signature_data,
44- get_trait_const_signature_data, get_trait_function_signature_data, get_trait_signature_data,
45- get_trait_type_full_signature,
46- } ;
37+ use crate :: signature_data:: { DocumentableItemSignatureData , SignatureDataRetriever } ;
4738use crate :: signature_errors:: SignatureError ;
4839
4940/// Used for indenting children items of complex data type signature, e.g., struct members.
@@ -242,7 +233,7 @@ impl<'db> HirDisplay<'db> for VariantId<'db> {
242233
243234impl < ' db > HirDisplay < ' db > for EnumId < ' db > {
244235 fn hir_fmt ( & self , f : & mut HirFormatter < ' db > ) -> Result < ( ) , SignatureError > {
245- let enum_full_signature = get_enum_signature_data ( f. db , * self ) ?;
236+ let enum_full_signature = Self :: retrieve_signature_data ( f. db , * self ) ?;
246237 write ! (
247238 f,
248239 "{}enum {} {{" ,
@@ -284,7 +275,7 @@ impl<'db> HirDisplay<'db> for EnumId<'db> {
284275
285276impl < ' db > HirDisplay < ' db > for MemberId < ' db > {
286277 fn hir_fmt ( & self , f : & mut HirFormatter < ' db > ) -> Result < ( ) , SignatureError > {
287- let member_full_signature = get_member_signature_data ( f. db , * self ) ?;
278+ let member_full_signature = Self :: retrieve_signature_data ( f. db , * self ) ?;
288279 if let Some ( return_type) = member_full_signature. return_type {
289280 if return_type. is_unit ( f. db ) {
290281 write ! (
@@ -314,7 +305,7 @@ impl<'db> HirDisplay<'db> for MemberId<'db> {
314305
315306impl < ' db > HirDisplay < ' db > for StructId < ' db > {
316307 fn hir_fmt ( & self , f : & mut HirFormatter < ' db > ) -> Result < ( ) , SignatureError > {
317- let struct_full_signature = get_struct_signature_data ( f. db , * self ) ?;
308+ let struct_full_signature = Self :: retrieve_signature_data ( f. db , * self ) ?;
318309 if let Some ( attributes) = struct_full_signature. attributes {
319310 write_struct_attributes_syntax ( attributes, f) . map_err ( |_| {
320311 SignatureError :: FailedWritingSignature ( struct_full_signature. full_path . clone ( ) )
@@ -367,7 +358,7 @@ impl<'db> HirDisplay<'db> for StructId<'db> {
367358
368359impl < ' db > HirDisplay < ' db > for FreeFunctionId < ' db > {
369360 fn hir_fmt ( & self , f : & mut HirFormatter < ' db > ) -> Result < ( ) , SignatureError > {
370- let free_function_full_signature = get_free_function_signature_data ( f. db , * self ) ?;
361+ let free_function_full_signature = Self :: retrieve_signature_data ( f. db , * self ) ?;
371362 write_function_signature ( f, free_function_full_signature, "" . to_string ( ) )
372363 . map_err ( |_| SignatureError :: FailedWritingSignature ( self . full_path ( f. db ) ) ) ?;
373364 f. format ( ) ;
@@ -377,7 +368,7 @@ impl<'db> HirDisplay<'db> for FreeFunctionId<'db> {
377368
378369impl < ' db > HirDisplay < ' db > for ConstantId < ' db > {
379370 fn hir_fmt ( & self , f : & mut HirFormatter < ' db > ) -> Result < ( ) , SignatureError > {
380- let constant_full_signature = get_constant_signature_data ( f. db , * self ) ?;
371+ let constant_full_signature = Self :: retrieve_signature_data ( f. db , * self ) ?;
381372 write ! (
382373 f,
383374 "{}const {}: " ,
@@ -441,7 +432,7 @@ impl<'db> HirDisplay<'db> for ConstantId<'db> {
441432
442433impl < ' db > HirDisplay < ' db > for ImplConstantDefId < ' db > {
443434 fn hir_fmt ( & self , f : & mut HirFormatter < ' db > ) -> Result < ( ) , SignatureError > {
444- let constant_full_signature = get_impl_constant_signature_data ( f. db , * self ) ?;
435+ let constant_full_signature = Self :: retrieve_signature_data ( f. db , * self ) ?;
445436 if let Some ( return_type) = constant_full_signature. return_type {
446437 f. write_type (
447438 Some ( & format ! ( "const {}: " , constant_full_signature. name. long( f. db) ) ) ,
@@ -463,7 +454,7 @@ impl<'db> HirDisplay<'db> for ImplConstantDefId<'db> {
463454
464455impl < ' db > HirDisplay < ' db > for TraitFunctionId < ' db > {
465456 fn hir_fmt ( & self , f : & mut HirFormatter < ' db > ) -> Result < ( ) , SignatureError > {
466- let trait_function_full_signature = get_trait_function_signature_data ( f. db , * self ) ?;
457+ let trait_function_full_signature = Self :: retrieve_signature_data ( f. db , * self ) ?;
467458 write_function_signature ( f, trait_function_full_signature, "" . to_string ( ) )
468459 . map_err ( |_| SignatureError :: FailedWritingSignature ( self . full_path ( f. db ) ) ) ?;
469460 f. format ( ) ;
@@ -473,7 +464,7 @@ impl<'db> HirDisplay<'db> for TraitFunctionId<'db> {
473464
474465impl < ' db > HirDisplay < ' db > for ImplFunctionId < ' db > {
475466 fn hir_fmt ( & self , f : & mut HirFormatter < ' db > ) -> Result < ( ) , SignatureError > {
476- let impl_function_full_signature = get_impl_function_signature_data ( f. db , * self ) ?;
467+ let impl_function_full_signature = Self :: retrieve_signature_data ( f. db , * self ) ?;
477468 write_function_signature ( f, impl_function_full_signature, "" . to_string ( ) )
478469 . map_err ( |_| SignatureError :: FailedWritingSignature ( self . full_path ( f. db ) ) ) ?;
479470 f. format ( ) ;
@@ -483,7 +474,7 @@ impl<'db> HirDisplay<'db> for ImplFunctionId<'db> {
483474
484475impl < ' db > HirDisplay < ' db > for TraitId < ' db > {
485476 fn hir_fmt ( & self , f : & mut HirFormatter < ' db > ) -> Result < ( ) , SignatureError > {
486- let trait_full_signature = get_trait_signature_data ( f. db , * self ) ?;
477+ let trait_full_signature = Self :: retrieve_signature_data ( f. db , * self ) ?;
487478 write ! (
488479 f,
489480 "{}trait {}" ,
@@ -505,7 +496,7 @@ impl<'db> HirDisplay<'db> for TraitId<'db> {
505496
506497impl < ' db > HirDisplay < ' db > for TraitConstantId < ' db > {
507498 fn hir_fmt ( & self , f : & mut HirFormatter < ' db > ) -> Result < ( ) , SignatureError > {
508- let trait_const_full_signature = get_trait_const_signature_data ( f. db , * self ) ?;
499+ let trait_const_full_signature = Self :: retrieve_signature_data ( f. db , * self ) ?;
509500 if let Some ( return_type) = trait_const_full_signature. return_type {
510501 write ! (
511502 f,
@@ -526,7 +517,7 @@ impl<'db> HirDisplay<'db> for TraitConstantId<'db> {
526517
527518impl < ' db > HirDisplay < ' db > for ImplDefId < ' db > {
528519 fn hir_fmt ( & self , f : & mut HirFormatter < ' db > ) -> Result < ( ) , SignatureError > {
529- let impl_def_full_signature = get_impl_def_signature_data ( f. db , * self ) ?;
520+ let impl_def_full_signature = Self :: retrieve_signature_data ( f. db , * self ) ?;
530521 let trait_id = f. db . impl_def_trait ( * self ) . map_err ( |_| {
531522 SignatureError :: FailedRetrievingSemanticData ( impl_def_full_signature. full_path . clone ( ) )
532523 } ) ?;
@@ -560,7 +551,7 @@ impl<'db> HirDisplay<'db> for ImplDefId<'db> {
560551
561552impl < ' db > HirDisplay < ' db > for ImplAliasId < ' db > {
562553 fn hir_fmt ( & self , f : & mut HirFormatter < ' db > ) -> Result < ( ) , SignatureError > {
563- let impl_alias_full_signature = get_impl_alias_signature_data ( f. db , * self ) ?;
554+ let impl_alias_full_signature = Self :: retrieve_signature_data ( f. db , * self ) ?;
564555 write ! (
565556 f,
566557 "{}impl {} = " ,
@@ -580,7 +571,7 @@ impl<'db> HirDisplay<'db> for ImplAliasId<'db> {
580571
581572impl < ' db > HirDisplay < ' db > for ModuleTypeAliasId < ' db > {
582573 fn hir_fmt ( & self , f : & mut HirFormatter < ' db > ) -> Result < ( ) , SignatureError > {
583- let module_type_alias_full_signature = get_module_type_alias_full_signature ( f. db , * self ) ?;
574+ let module_type_alias_full_signature = Self :: retrieve_signature_data ( f. db , * self ) ?;
584575 write_type_signature ( f, module_type_alias_full_signature, false )
585576 . map_err ( |_| SignatureError :: FailedWritingSignature ( self . full_path ( f. db ) ) ) ?;
586577 f. format ( ) ;
@@ -590,7 +581,7 @@ impl<'db> HirDisplay<'db> for ModuleTypeAliasId<'db> {
590581
591582impl < ' db > HirDisplay < ' db > for TraitTypeId < ' db > {
592583 fn hir_fmt ( & self , f : & mut HirFormatter < ' db > ) -> Result < ( ) , SignatureError > {
593- let trait_type_full_signature = get_trait_type_full_signature ( f. db , * self ) ?;
584+ let trait_type_full_signature = Self :: retrieve_signature_data ( f. db , * self ) ?;
594585 write_type_signature ( f, trait_type_full_signature, false )
595586 . map_err ( |_| SignatureError :: FailedWritingSignature ( self . full_path ( f. db ) ) ) ?;
596587 f. format ( ) ;
@@ -600,7 +591,7 @@ impl<'db> HirDisplay<'db> for TraitTypeId<'db> {
600591
601592impl < ' db > HirDisplay < ' db > for ImplTypeDefId < ' db > {
602593 fn hir_fmt ( & self , f : & mut HirFormatter < ' db > ) -> Result < ( ) , SignatureError > {
603- let impl_type_def_full_signature = get_impl_type_def_full_signature ( f. db , * self ) ?;
594+ let impl_type_def_full_signature = Self :: retrieve_signature_data ( f. db , * self ) ?;
604595 write_type_signature ( f, impl_type_def_full_signature, false )
605596 . map_err ( |_| SignatureError :: FailedWritingSignature ( self . full_path ( f. db ) ) ) ?;
606597 f. format ( ) ;
@@ -610,7 +601,7 @@ impl<'db> HirDisplay<'db> for ImplTypeDefId<'db> {
610601
611602impl < ' db > HirDisplay < ' db > for ExternTypeId < ' db > {
612603 fn hir_fmt ( & self , f : & mut HirFormatter < ' db > ) -> Result < ( ) , SignatureError > {
613- let extern_type_full_signature = get_extern_type_full_signature ( f. db , * self ) ?;
604+ let extern_type_full_signature = Self :: retrieve_signature_data ( f. db , * self ) ?;
614605 write_type_signature ( f, extern_type_full_signature, true )
615606 . map_err ( |_| SignatureError :: FailedWritingSignature ( self . full_path ( f. db ) ) ) ?;
616607 f. format ( ) ;
@@ -620,7 +611,7 @@ impl<'db> HirDisplay<'db> for ExternTypeId<'db> {
620611
621612impl < ' db > HirDisplay < ' db > for ExternFunctionId < ' db > {
622613 fn hir_fmt ( & self , f : & mut HirFormatter < ' db > ) -> Result < ( ) , SignatureError > {
623- let extern_function_full_signature = get_extern_function_full_signature ( f. db , * self ) ?;
614+ let extern_function_full_signature = Self :: retrieve_signature_data ( f. db , * self ) ?;
624615 let signature = match f. db . extern_function_signature ( * self ) {
625616 Ok ( signature) => signature,
626617 _ => {
0 commit comments