Replace ra_hir_expand::either with crate

This commit is contained in:
ice1000 2019-12-03 11:07:56 -05:00
parent 15f143f0c3
commit 009437f5d9
23 changed files with 69 additions and 112 deletions

View file

@ -4,6 +4,7 @@ pub(crate) mod src;
use std::sync::Arc;
use either::Either;
use hir_def::{
adt::VariantData,
body::{Body, BodySourceMap},
@ -30,7 +31,7 @@ use crate::{
db::{DefDatabase, HirDatabase},
ty::display::HirFormatter,
ty::{self, InEnvironment, InferenceResult, TraitEnvironment, Ty, TyDefId, TypeCtor, TypeWalk},
CallableDef, Either, HirDisplay, InFile, Name,
CallableDef, HirDisplay, InFile, Name,
};
/// hir::Crate describes a single crate. It's the main interface with which
@ -905,7 +906,9 @@ impl Local {
let (_body, source_map) = db.body_with_source_map(self.parent.into());
let src = source_map.pat_syntax(self.pat_id).unwrap(); // Hmm...
let root = src.file_syntax(db);
src.map(|ast| ast.map(|it| it.cast().unwrap().to_node(&root), |it| it.to_node(&root)))
src.map(|ast| {
ast.map_left(|it| it.cast().unwrap().to_node(&root)).map_right(|it| it.to_node(&root))
})
}
}