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 /crates/ra_hir/src/nameres | |
parent | 40f91341595508833d39eb6d97e4ec2ac7f685cb (diff) |
Strip
Diffstat (limited to 'crates/ra_hir/src/nameres')
-rw-r--r-- | crates/ra_hir/src/nameres/per_ns.rs | 12 |
1 files changed, 3 insertions, 9 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 | } |