]> git.lizzy.rs Git - rust.git/blobdiff - crates/ra_hir/src/code_model/src.rs
Replace `ra_hir_expand::either` with crate
[rust.git] / crates / ra_hir / src / code_model / src.rs
index 2cf2103497ee3d196b82d0a4b583f408d0593dc5..36cfbc8f12b27083fd358187992cfd0c68132723 100644 (file)
@@ -1,10 +1,10 @@
 //! FIXME: write short doc here
 
+use either::Either;
 use hir_def::{
     src::{HasChildSource, HasSource as _},
     AstItemDef, Lookup, VariantId,
 };
-use hir_expand::either::Either;
 use ra_syntax::ast;
 
 use crate::{
@@ -27,8 +27,8 @@ pub fn definition_source(self, db: &impl DefDatabase) -> InFile<ModuleSource> {
         let def_map = db.crate_def_map(self.id.krate);
         let src = def_map[self.id.local_id].definition_source(db);
         src.map(|it| match it {
-            Either::A(it) => ModuleSource::SourceFile(it),
-            Either::B(it) => ModuleSource::Module(it),
+            Either::Left(it) => ModuleSource::SourceFile(it),
+            Either::Right(it) => ModuleSource::Module(it),
         })
     }
 
@@ -46,8 +46,8 @@ fn source(self, db: &impl DefDatabase) -> InFile<FieldSource> {
         let var = VariantId::from(self.parent);
         let src = var.child_source(db);
         src.map(|it| match it[self.id].clone() {
-            Either::A(it) => FieldSource::Pos(it),
-            Either::B(it) => FieldSource::Named(it),
+            Either::Left(it) => FieldSource::Pos(it),
+            Either::Right(it) => FieldSource::Named(it),
         })
     }
 }
@@ -126,6 +126,6 @@ fn source(self, db: &impl DefDatabase) -> InFile<Self::Ast> {
         let (_, source_map) = db.raw_items_with_source_map(src.file_id);
         let root = db.parse_or_expand(src.file_id).unwrap();
         let ptr = source_map.get(self.id);
-        src.with_value(ptr.map(|it| it.to_node(&root), |it| it.to_node(&root)))
+        src.with_value(ptr.map_left(|it| it.to_node(&root)).map_right(|it| it.to_node(&root)))
     }
 }