diff options
Diffstat (limited to 'crates/ra_hir/src/code_model.rs')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index dddac915b..5877afefa 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -4,6 +4,7 @@ pub(crate) mod src; | |||
4 | 4 | ||
5 | use std::sync::Arc; | 5 | use std::sync::Arc; |
6 | 6 | ||
7 | use either::Either; | ||
7 | use hir_def::{ | 8 | use hir_def::{ |
8 | adt::VariantData, | 9 | adt::VariantData, |
9 | body::{Body, BodySourceMap}, | 10 | body::{Body, BodySourceMap}, |
@@ -30,7 +31,7 @@ use crate::{ | |||
30 | db::{DefDatabase, HirDatabase}, | 31 | db::{DefDatabase, HirDatabase}, |
31 | ty::display::HirFormatter, | 32 | ty::display::HirFormatter, |
32 | ty::{self, InEnvironment, InferenceResult, TraitEnvironment, Ty, TyDefId, TypeCtor, TypeWalk}, | 33 | ty::{self, InEnvironment, InferenceResult, TraitEnvironment, Ty, TyDefId, TypeCtor, TypeWalk}, |
33 | CallableDef, Either, HirDisplay, InFile, Name, | 34 | CallableDef, HirDisplay, InFile, Name, |
34 | }; | 35 | }; |
35 | 36 | ||
36 | /// hir::Crate describes a single crate. It's the main interface with which | 37 | /// hir::Crate describes a single crate. It's the main interface with which |
@@ -905,7 +906,9 @@ impl Local { | |||
905 | let (_body, source_map) = db.body_with_source_map(self.parent.into()); | 906 | let (_body, source_map) = db.body_with_source_map(self.parent.into()); |
906 | let src = source_map.pat_syntax(self.pat_id).unwrap(); // Hmm... | 907 | let src = source_map.pat_syntax(self.pat_id).unwrap(); // Hmm... |
907 | let root = src.file_syntax(db); | 908 | let root = src.file_syntax(db); |
908 | src.map(|ast| ast.map(|it| it.cast().unwrap().to_node(&root), |it| it.to_node(&root))) | 909 | src.map(|ast| { |
910 | ast.map_left(|it| it.cast().unwrap().to_node(&root)).map_right(|it| it.to_node(&root)) | ||
911 | }) | ||
909 | } | 912 | } |
910 | } | 913 | } |
911 | 914 | ||