diff options
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r-- | crates/ra_hir/src/ty/lower.rs | 39 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/op.rs | 4 |
2 files changed, 2 insertions, 41 deletions
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index d776b6cd0..5dce2f342 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs | |||
@@ -31,8 +31,7 @@ use crate::{ | |||
31 | utils::{all_super_traits, associated_type_by_name_including_super_traits, variant_data}, | 31 | utils::{all_super_traits, associated_type_by_name_including_super_traits, variant_data}, |
32 | }, | 32 | }, |
33 | util::make_mut_slice, | 33 | util::make_mut_slice, |
34 | Adt, Const, Enum, EnumVariant, Function, ImplBlock, ModuleDef, Static, Struct, Trait, | 34 | ImplBlock, Trait, |
35 | TypeAlias, Union, | ||
36 | }; | 35 | }; |
37 | 36 | ||
38 | impl Ty { | 37 | impl Ty { |
@@ -694,42 +693,6 @@ fn type_for_type_alias(db: &impl HirDatabase, t: TypeAliasId) -> Ty { | |||
694 | } | 693 | } |
695 | 694 | ||
696 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] | 695 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] |
697 | pub enum TypableDef { | ||
698 | Function(Function), | ||
699 | Adt(Adt), | ||
700 | EnumVariant(EnumVariant), | ||
701 | TypeAlias(TypeAlias), | ||
702 | Const(Const), | ||
703 | Static(Static), | ||
704 | BuiltinType(BuiltinType), | ||
705 | } | ||
706 | impl_froms!( | ||
707 | TypableDef: Function, | ||
708 | Adt(Struct, Enum, Union), | ||
709 | EnumVariant, | ||
710 | TypeAlias, | ||
711 | Const, | ||
712 | Static, | ||
713 | BuiltinType | ||
714 | ); | ||
715 | |||
716 | impl From<ModuleDef> for Option<TypableDef> { | ||
717 | fn from(def: ModuleDef) -> Option<TypableDef> { | ||
718 | let res = match def { | ||
719 | ModuleDef::Function(f) => f.into(), | ||
720 | ModuleDef::Adt(adt) => adt.into(), | ||
721 | ModuleDef::EnumVariant(v) => v.into(), | ||
722 | ModuleDef::TypeAlias(t) => t.into(), | ||
723 | ModuleDef::Const(v) => v.into(), | ||
724 | ModuleDef::Static(v) => v.into(), | ||
725 | ModuleDef::BuiltinType(t) => t.into(), | ||
726 | ModuleDef::Module(_) | ModuleDef::Trait(_) => return None, | ||
727 | }; | ||
728 | Some(res) | ||
729 | } | ||
730 | } | ||
731 | |||
732 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] | ||
733 | pub enum CallableDef { | 696 | pub enum CallableDef { |
734 | FunctionId(FunctionId), | 697 | FunctionId(FunctionId), |
735 | StructId(StructId), | 698 | StructId(StructId), |
diff --git a/crates/ra_hir/src/ty/op.rs b/crates/ra_hir/src/ty/op.rs index 80d4111a0..cc6e244f4 100644 --- a/crates/ra_hir/src/ty/op.rs +++ b/crates/ra_hir/src/ty/op.rs | |||
@@ -2,9 +2,7 @@ | |||
2 | use hir_def::expr::{BinaryOp, CmpOp}; | 2 | use hir_def::expr::{BinaryOp, CmpOp}; |
3 | 3 | ||
4 | use super::{InferTy, Ty, TypeCtor}; | 4 | use super::{InferTy, Ty, TypeCtor}; |
5 | use crate::{ | 5 | use crate::ty::ApplicationTy; |
6 | ty::ApplicationTy, | ||
7 | }; | ||
8 | 6 | ||
9 | pub(super) fn binary_op_return_ty(op: BinaryOp, rhs_ty: Ty) -> Ty { | 7 | pub(super) fn binary_op_return_ty(op: BinaryOp, rhs_ty: Ty) -> Ty { |
10 | match op { | 8 | match op { |