diff options
author | Aleksey Kladov <[email protected]> | 2019-02-11 14:29:20 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-02-11 14:29:20 +0000 |
commit | 8cafdb3a99d7e5f91dd89dd83884d964aa6e1fda (patch) | |
tree | daf3d195a675e44045a843b29b379b7097a170ac /crates/ra_hir/src | |
parent | 821d980fd950679315bb12659a13347233895e67 (diff) |
rename combine -> or
This way we match API of Option
https://doc.rust-lang.org/std/option/enum.Option.html#method.or
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/nameres.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/resolve.rs | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs index 4b8097235..261ebdf97 100644 --- a/crates/ra_hir/src/nameres.rs +++ b/crates/ra_hir/src/nameres.rs | |||
@@ -135,7 +135,7 @@ impl<T> PerNs<T> { | |||
135 | PerNs { types: self.types.as_ref(), values: self.values.as_ref() } | 135 | PerNs { types: self.types.as_ref(), values: self.values.as_ref() } |
136 | } | 136 | } |
137 | 137 | ||
138 | pub fn combine(self, other: PerNs<T>) -> PerNs<T> { | 138 | pub fn or(self, other: PerNs<T>) -> PerNs<T> { |
139 | PerNs { types: self.types.or(other.types), values: self.values.or(other.values) } | 139 | PerNs { types: self.types.or(other.types), values: self.values.or(other.values) } |
140 | } | 140 | } |
141 | 141 | ||
@@ -439,7 +439,7 @@ impl ItemMap { | |||
439 | let from_extern_prelude = | 439 | let from_extern_prelude = |
440 | self.extern_prelude.get(name).map_or(PerNs::none(), |&it| PerNs::types(it)); | 440 | self.extern_prelude.get(name).map_or(PerNs::none(), |&it| PerNs::types(it)); |
441 | 441 | ||
442 | from_scope.combine(from_extern_prelude) | 442 | from_scope.or(from_extern_prelude) |
443 | } | 443 | } |
444 | 444 | ||
445 | // Returns Yes if we are sure that additions to `ItemMap` wouldn't change | 445 | // Returns Yes if we are sure that additions to `ItemMap` wouldn't change |
diff --git a/crates/ra_hir/src/resolve.rs b/crates/ra_hir/src/resolve.rs index e8abac5bc..40c860cf4 100644 --- a/crates/ra_hir/src/resolve.rs +++ b/crates/ra_hir/src/resolve.rs | |||
@@ -59,7 +59,7 @@ impl Resolver { | |||
59 | pub fn resolve_name(&self, name: &Name) -> PerNs<Resolution> { | 59 | pub fn resolve_name(&self, name: &Name) -> PerNs<Resolution> { |
60 | let mut resolution = PerNs::none(); | 60 | let mut resolution = PerNs::none(); |
61 | for scope in self.scopes.iter().rev() { | 61 | for scope in self.scopes.iter().rev() { |
62 | resolution = resolution.combine(scope.resolve_name(name)); | 62 | resolution = resolution.or(scope.resolve_name(name)); |
63 | if resolution.is_both() { | 63 | if resolution.is_both() { |
64 | return resolution; | 64 | return resolution; |
65 | } | 65 | } |