diff options
author | Aramis Razzaghipour <[email protected]> | 2021-05-24 00:42:06 +0100 |
---|---|---|
committer | Aramis Razzaghipour <[email protected]> | 2021-05-24 05:54:16 +0100 |
commit | c32428571c3fbf12bd4a4187c797488355416a18 (patch) | |
tree | 482c2a1a2a88554f1b1aed4417f3262233e96ab4 /crates/hir | |
parent | 4fd5248749202e0578d719bc5480171a85358836 (diff) |
Remove hir krate methods
Diffstat (limited to 'crates/hir')
-rw-r--r-- | crates/hir/src/lib.rs | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 6522a924b..ec5f0c53d 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -552,10 +552,6 @@ impl Struct { | |||
552 | Module { id: self.id.lookup(db.upcast()).container } | 552 | Module { id: self.id.lookup(db.upcast()).container } |
553 | } | 553 | } |
554 | 554 | ||
555 | pub fn krate(self, db: &dyn HirDatabase) -> Option<Crate> { | ||
556 | Some(self.module(db).krate()) | ||
557 | } | ||
558 | |||
559 | pub fn name(self, db: &dyn HirDatabase) -> Name { | 555 | pub fn name(self, db: &dyn HirDatabase) -> Name { |
560 | db.struct_data(self.id).name.clone() | 556 | db.struct_data(self.id).name.clone() |
561 | } | 557 | } |
@@ -640,10 +636,6 @@ impl Enum { | |||
640 | Module { id: self.id.lookup(db.upcast()).container } | 636 | Module { id: self.id.lookup(db.upcast()).container } |
641 | } | 637 | } |
642 | 638 | ||
643 | pub fn krate(self, db: &dyn HirDatabase) -> Option<Crate> { | ||
644 | Some(self.module(db).krate()) | ||
645 | } | ||
646 | |||
647 | pub fn name(self, db: &dyn HirDatabase) -> Name { | 639 | pub fn name(self, db: &dyn HirDatabase) -> Name { |
648 | db.enum_data(self.id).name.clone() | 640 | db.enum_data(self.id).name.clone() |
649 | } | 641 | } |
@@ -674,10 +666,6 @@ impl Variant { | |||
674 | self.parent.module(db) | 666 | self.parent.module(db) |
675 | } | 667 | } |
676 | 668 | ||
677 | pub fn krate(self, db: &dyn HirDatabase) -> Crate { | ||
678 | self.module(db).krate() | ||
679 | } | ||
680 | |||
681 | pub fn parent_enum(self, _db: &dyn HirDatabase) -> Enum { | 669 | pub fn parent_enum(self, _db: &dyn HirDatabase) -> Enum { |
682 | self.parent | 670 | self.parent |
683 | } | 671 | } |
@@ -734,10 +722,6 @@ impl Adt { | |||
734 | } | 722 | } |
735 | } | 723 | } |
736 | 724 | ||
737 | pub fn krate(self, db: &dyn HirDatabase) -> Crate { | ||
738 | self.module(db).krate() | ||
739 | } | ||
740 | |||
741 | pub fn name(self, db: &dyn HirDatabase) -> Name { | 725 | pub fn name(self, db: &dyn HirDatabase) -> Name { |
742 | match self { | 726 | match self { |
743 | Adt::Struct(s) => s.name(db), | 727 | Adt::Struct(s) => s.name(db), |
@@ -772,10 +756,6 @@ impl VariantDef { | |||
772 | } | 756 | } |
773 | } | 757 | } |
774 | 758 | ||
775 | pub fn krate(self, db: &dyn HirDatabase) -> Crate { | ||
776 | self.module(db).krate() | ||
777 | } | ||
778 | |||
779 | pub fn name(&self, db: &dyn HirDatabase) -> Name { | 759 | pub fn name(&self, db: &dyn HirDatabase) -> Name { |
780 | match self { | 760 | match self { |
781 | VariantDef::Struct(s) => s.name(db), | 761 | VariantDef::Struct(s) => s.name(db), |
@@ -830,10 +810,6 @@ impl Function { | |||
830 | self.id.lookup(db.upcast()).module(db.upcast()).into() | 810 | self.id.lookup(db.upcast()).module(db.upcast()).into() |
831 | } | 811 | } |
832 | 812 | ||
833 | pub fn krate(self, db: &dyn HirDatabase) -> Option<Crate> { | ||
834 | Some(self.module(db).krate()) | ||
835 | } | ||
836 | |||
837 | pub fn name(self, db: &dyn HirDatabase) -> Name { | 813 | pub fn name(self, db: &dyn HirDatabase) -> Name { |
838 | db.function_data(self.id).name.clone() | 814 | db.function_data(self.id).name.clone() |
839 | } | 815 | } |
@@ -1023,10 +999,6 @@ impl Const { | |||
1023 | Module { id: self.id.lookup(db.upcast()).module(db.upcast()) } | 999 | Module { id: self.id.lookup(db.upcast()).module(db.upcast()) } |
1024 | } | 1000 | } |
1025 | 1001 | ||
1026 | pub fn krate(self, db: &dyn HirDatabase) -> Option<Crate> { | ||
1027 | Some(self.module(db).krate()) | ||
1028 | } | ||
1029 | |||
1030 | pub fn name(self, db: &dyn HirDatabase) -> Option<Name> { | 1002 | pub fn name(self, db: &dyn HirDatabase) -> Option<Name> { |
1031 | db.const_data(self.id).name.clone() | 1003 | db.const_data(self.id).name.clone() |
1032 | } | 1004 | } |
@@ -1054,10 +1026,6 @@ impl Static { | |||
1054 | Module { id: self.id.lookup(db.upcast()).module(db.upcast()) } | 1026 | Module { id: self.id.lookup(db.upcast()).module(db.upcast()) } |
1055 | } | 1027 | } |
1056 | 1028 | ||
1057 | pub fn krate(self, db: &dyn HirDatabase) -> Option<Crate> { | ||
1058 | Some(self.module(db).krate()) | ||
1059 | } | ||
1060 | |||
1061 | pub fn name(self, db: &dyn HirDatabase) -> Option<Name> { | 1029 | pub fn name(self, db: &dyn HirDatabase) -> Option<Name> { |
1062 | db.static_data(self.id).name.clone() | 1030 | db.static_data(self.id).name.clone() |
1063 | } | 1031 | } |
@@ -1083,10 +1051,6 @@ impl Trait { | |||
1083 | Module { id: self.id.lookup(db.upcast()).container } | 1051 | Module { id: self.id.lookup(db.upcast()).container } |
1084 | } | 1052 | } |
1085 | 1053 | ||
1086 | pub fn krate(self, db: &dyn HirDatabase) -> Crate { | ||
1087 | self.module(db).krate() | ||
1088 | } | ||
1089 | |||
1090 | pub fn name(self, db: &dyn HirDatabase) -> Name { | 1054 | pub fn name(self, db: &dyn HirDatabase) -> Name { |
1091 | db.trait_data(self.id).name.clone() | 1055 | db.trait_data(self.id).name.clone() |
1092 | } | 1056 | } |
@@ -1125,10 +1089,6 @@ impl TypeAlias { | |||
1125 | Module { id: self.id.lookup(db.upcast()).module(db.upcast()) } | 1089 | Module { id: self.id.lookup(db.upcast()).module(db.upcast()) } |
1126 | } | 1090 | } |
1127 | 1091 | ||
1128 | pub fn krate(self, db: &dyn HirDatabase) -> Crate { | ||
1129 | self.module(db).krate() | ||
1130 | } | ||
1131 | |||
1132 | pub fn type_ref(self, db: &dyn HirDatabase) -> Option<TypeRef> { | 1092 | pub fn type_ref(self, db: &dyn HirDatabase) -> Option<TypeRef> { |
1133 | db.type_alias_data(self.id).type_ref.as_deref().cloned() | 1093 | db.type_alias_data(self.id).type_ref.as_deref().cloned() |
1134 | } | 1094 | } |
@@ -1191,10 +1151,6 @@ impl MacroDef { | |||
1191 | Some(Module { id: def_map.module_id(module_id) }) | 1151 | Some(Module { id: def_map.module_id(module_id) }) |
1192 | } | 1152 | } |
1193 | 1153 | ||
1194 | pub fn krate(self, db: &dyn HirDatabase) -> Option<Crate> { | ||
1195 | self.module(db).map(Module::krate) | ||
1196 | } | ||
1197 | |||
1198 | /// XXX: this parses the file | 1154 | /// XXX: this parses the file |
1199 | pub fn name(self, db: &dyn HirDatabase) -> Option<Name> { | 1155 | pub fn name(self, db: &dyn HirDatabase) -> Option<Name> { |
1200 | match self.source(db)?.value { | 1156 | match self.source(db)?.value { |
@@ -1684,10 +1640,6 @@ impl Impl { | |||
1684 | self.id.lookup(db.upcast()).container.into() | 1640 | self.id.lookup(db.upcast()).container.into() |
1685 | } | 1641 | } |
1686 | 1642 | ||
1687 | pub fn krate(self, db: &dyn HirDatabase) -> Crate { | ||
1688 | Crate { id: self.module(db).id.krate() } | ||
1689 | } | ||
1690 | |||
1691 | pub fn is_builtin_derive(self, db: &dyn HirDatabase) -> Option<InFile<ast::Attr>> { | 1643 | pub fn is_builtin_derive(self, db: &dyn HirDatabase) -> Option<InFile<ast::Attr>> { |
1692 | let src = self.source(db)?; | 1644 | let src = self.source(db)?; |
1693 | let item = src.file_id.is_builtin_derive(db.upcast())?; | 1645 | let item = src.file_id.is_builtin_derive(db.upcast())?; |