diff options
author | uHOOCCOOHu <[email protected]> | 2019-09-09 18:21:29 +0100 |
---|---|---|
committer | uHOOCCOOHu <[email protected]> | 2019-09-09 18:21:29 +0100 |
commit | 5f48ef39024f62c135197e764741354611e02b6f (patch) | |
tree | 8317f27e42132173d175770c818ba49a93a2cd7f | |
parent | 40f91341595508833d39eb6d97e4ec2ac7f685cb (diff) |
Strip
-rw-r--r-- | crates/ra_hir/src/nameres/per_ns.rs | 12 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/lower.rs | 3 |
2 files changed, 3 insertions, 12 deletions
diff --git a/crates/ra_hir/src/nameres/per_ns.rs b/crates/ra_hir/src/nameres/per_ns.rs index 6a50e05c1..d07cc08f4 100644 --- a/crates/ra_hir/src/nameres/per_ns.rs +++ b/crates/ra_hir/src/nameres/per_ns.rs | |||
@@ -4,7 +4,8 @@ use crate::MacroDef; | |||
4 | pub enum Namespace { | 4 | pub enum Namespace { |
5 | Types, | 5 | Types, |
6 | Values, | 6 | Values, |
7 | Macro, | 7 | // Note that only type inference uses this enum, and it doesn't care about macros. |
8 | // Macro, | ||
8 | } | 9 | } |
9 | 10 | ||
10 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] | 11 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] |
@@ -79,14 +80,7 @@ impl<T> PerNs<T> { | |||
79 | } | 80 | } |
80 | } | 81 | } |
81 | 82 | ||
82 | pub fn and_then<U>(self, f: impl Fn(T) -> Option<U>) -> PerNs<U> { | 83 | /// Map types and values. Leave macros unchanged. |
83 | PerNs { | ||
84 | types: self.types.and_then(&f), | ||
85 | values: self.values.and_then(&f), | ||
86 | macros: self.macros, | ||
87 | } | ||
88 | } | ||
89 | |||
90 | pub fn map<U>(self, f: impl Fn(T) -> U) -> PerNs<U> { | 84 | pub fn map<U>(self, f: impl Fn(T) -> U) -> PerNs<U> { |
91 | PerNs { types: self.types.map(&f), values: self.values.map(&f), macros: self.macros } | 85 | PerNs { types: self.types.map(&f), values: self.values.map(&f), macros: self.macros } |
92 | } | 86 | } |
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index a2adbc4b8..061229842 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs | |||
@@ -429,9 +429,6 @@ pub(crate) fn type_for_def(db: &impl HirDatabase, def: TypableDef, ns: Namespace | |||
429 | (TypableDef::Const(_), Namespace::Types) => Ty::Unknown, | 429 | (TypableDef::Const(_), Namespace::Types) => Ty::Unknown, |
430 | (TypableDef::Static(_), Namespace::Types) => Ty::Unknown, | 430 | (TypableDef::Static(_), Namespace::Types) => Ty::Unknown, |
431 | (TypableDef::BuiltinType(_), Namespace::Values) => Ty::Unknown, | 431 | (TypableDef::BuiltinType(_), Namespace::Values) => Ty::Unknown, |
432 | |||
433 | // Macro is not typeable | ||
434 | (_, Namespace::Macro) => Ty::Unknown, | ||
435 | } | 432 | } |
436 | } | 433 | } |
437 | 434 | ||