From 5f48ef39024f62c135197e764741354611e02b6f Mon Sep 17 00:00:00 2001 From: uHOOCCOOHu Date: Tue, 10 Sep 2019 01:21:29 +0800 Subject: [PATCH] Strip --- crates/ra_hir/src/nameres/per_ns.rs | 12 +++--------- 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 6a50e05c19..d07cc08f49 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; pub enum Namespace { Types, Values, - Macro, + // Note that only type inference uses this enum, and it doesn't care about macros. + // Macro, } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -79,14 +80,7 @@ impl PerNs { } } - pub fn and_then(self, f: impl Fn(T) -> Option) -> PerNs { - PerNs { - types: self.types.and_then(&f), - values: self.values.and_then(&f), - macros: self.macros, - } - } - + /// Map types and values. Leave macros unchanged. pub fn map(self, f: impl Fn(T) -> U) -> PerNs { PerNs { types: self.types.map(&f), values: self.values.map(&f), macros: self.macros } } diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index a2adbc4b8a..0612298423 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 (TypableDef::Const(_), Namespace::Types) => Ty::Unknown, (TypableDef::Static(_), Namespace::Types) => Ty::Unknown, (TypableDef::BuiltinType(_), Namespace::Values) => Ty::Unknown, - - // Macro is not typeable - (_, Namespace::Macro) => Ty::Unknown, } }