diff options
Diffstat (limited to 'crates/hir/src')
-rw-r--r-- | crates/hir/src/code_model.rs | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index a8b67da20..1a4aa78fb 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs | |||
@@ -744,19 +744,15 @@ impl Function { | |||
744 | } | 744 | } |
745 | 745 | ||
746 | /// Get this function's return type | 746 | /// Get this function's return type |
747 | /// | 747 | pub fn ret_type(self, db: &dyn HirDatabase) -> Type { |
748 | /// The returned type can be converted to a [`Type`] via its `ty` | ||
749 | /// method. | ||
750 | pub fn ret_type(self, db: &dyn HirDatabase) -> RetType { | ||
751 | let resolver = self.id.resolver(db.upcast()); | 748 | let resolver = self.id.resolver(db.upcast()); |
752 | let ret_type = &db.function_data(self.id).ret_type; | 749 | let ret_type = &db.function_data(self.id).ret_type; |
753 | let ctx = hir_ty::TyLoweringContext::new(db, &resolver); | 750 | let ctx = hir_ty::TyLoweringContext::new(db, &resolver); |
754 | let environment = TraitEnvironment::lower(db, &resolver); | 751 | let environment = TraitEnvironment::lower(db, &resolver); |
755 | let ty = Type { | 752 | Type { |
756 | krate: self.id.lookup(db.upcast()).container.module(db.upcast()).krate, | 753 | krate: self.id.lookup(db.upcast()).container.module(db.upcast()).krate, |
757 | ty: InEnvironment { value: Ty::from_hir_ext(&ctx, ret_type).0, environment }, | 754 | ty: InEnvironment { value: Ty::from_hir_ext(&ctx, ret_type).0, environment }, |
758 | }; | 755 | } |
759 | RetType { ty } | ||
760 | } | 756 | } |
761 | 757 | ||
762 | pub fn self_param(self, db: &dyn HirDatabase) -> Option<SelfParam> { | 758 | pub fn self_param(self, db: &dyn HirDatabase) -> Option<SelfParam> { |
@@ -843,17 +839,6 @@ impl From<Mutability> for Access { | |||
843 | } | 839 | } |
844 | 840 | ||
845 | #[derive(Debug)] | 841 | #[derive(Debug)] |
846 | pub struct RetType { | ||
847 | ty: Type, | ||
848 | } | ||
849 | |||
850 | impl RetType { | ||
851 | pub fn ty(&self) -> &Type { | ||
852 | &self.ty | ||
853 | } | ||
854 | } | ||
855 | |||
856 | #[derive(Debug)] | ||
857 | pub struct Param { | 842 | pub struct Param { |
858 | ty: Type, | 843 | ty: Type, |
859 | } | 844 | } |