diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-03 16:13:42 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-03 16:13:42 +0000 |
commit | 96b9d5b44ed50160c7a4eb07a31bee5f05b1ecf3 (patch) | |
tree | 74a889d70e201d6997c6baf179261ab3ed8bf23c /crates/ra_hir/src/code_model | |
parent | 15f143f0c33cbd382a2ad7a407d9601cb843d164 (diff) | |
parent | 009437f5d9949d2276aa26040e03af0ab328acf3 (diff) |
Merge #2469
2469: Replace `ra_hir_expand::either` with crate r=matklad a=ice1000
As title.
Co-authored-by: ice1000 <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/code_model')
-rw-r--r-- | crates/ra_hir/src/code_model/src.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_hir/src/code_model/src.rs b/crates/ra_hir/src/code_model/src.rs index 2cf210349..36cfbc8f1 100644 --- a/crates/ra_hir/src/code_model/src.rs +++ b/crates/ra_hir/src/code_model/src.rs | |||
@@ -1,10 +1,10 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use either::Either; | ||
3 | use hir_def::{ | 4 | use hir_def::{ |
4 | src::{HasChildSource, HasSource as _}, | 5 | src::{HasChildSource, HasSource as _}, |
5 | AstItemDef, Lookup, VariantId, | 6 | AstItemDef, Lookup, VariantId, |
6 | }; | 7 | }; |
7 | use hir_expand::either::Either; | ||
8 | use ra_syntax::ast; | 8 | use ra_syntax::ast; |
9 | 9 | ||
10 | use crate::{ | 10 | use crate::{ |
@@ -27,8 +27,8 @@ impl Module { | |||
27 | let def_map = db.crate_def_map(self.id.krate); | 27 | let def_map = db.crate_def_map(self.id.krate); |
28 | let src = def_map[self.id.local_id].definition_source(db); | 28 | let src = def_map[self.id.local_id].definition_source(db); |
29 | src.map(|it| match it { | 29 | src.map(|it| match it { |
30 | Either::A(it) => ModuleSource::SourceFile(it), | 30 | Either::Left(it) => ModuleSource::SourceFile(it), |
31 | Either::B(it) => ModuleSource::Module(it), | 31 | Either::Right(it) => ModuleSource::Module(it), |
32 | }) | 32 | }) |
33 | } | 33 | } |
34 | 34 | ||
@@ -46,8 +46,8 @@ impl HasSource for StructField { | |||
46 | let var = VariantId::from(self.parent); | 46 | let var = VariantId::from(self.parent); |
47 | let src = var.child_source(db); | 47 | let src = var.child_source(db); |
48 | src.map(|it| match it[self.id].clone() { | 48 | src.map(|it| match it[self.id].clone() { |
49 | Either::A(it) => FieldSource::Pos(it), | 49 | Either::Left(it) => FieldSource::Pos(it), |
50 | Either::B(it) => FieldSource::Named(it), | 50 | Either::Right(it) => FieldSource::Named(it), |
51 | }) | 51 | }) |
52 | } | 52 | } |
53 | } | 53 | } |
@@ -126,6 +126,6 @@ impl HasSource for Import { | |||
126 | let (_, source_map) = db.raw_items_with_source_map(src.file_id); | 126 | let (_, source_map) = db.raw_items_with_source_map(src.file_id); |
127 | let root = db.parse_or_expand(src.file_id).unwrap(); | 127 | let root = db.parse_or_expand(src.file_id).unwrap(); |
128 | let ptr = source_map.get(self.id); | 128 | let ptr = source_map.get(self.id); |
129 | src.with_value(ptr.map(|it| it.to_node(&root), |it| it.to_node(&root))) | 129 | src.with_value(ptr.map_left(|it| it.to_node(&root)).map_right(|it| it.to_node(&root))) |
130 | } | 130 | } |
131 | } | 131 | } |