aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/from_source.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/from_source.rs')
-rw-r--r--crates/ra_hir/src/from_source.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs
index f506bba70..1e7c22774 100644
--- a/crates/ra_hir/src/from_source.rs
+++ b/crates/ra_hir/src/from_source.rs
@@ -9,9 +9,9 @@ use ra_syntax::{
9 9
10use crate::{ 10use crate::{
11 db::{AstDatabase, DefDatabase, HirDatabase}, 11 db::{AstDatabase, DefDatabase, HirDatabase},
12 AssocItem, Const, DefWithBody, Enum, EnumVariant, FieldSource, Function, HasBody, HasSource, 12 AssocItem, Const, DefWithBody, Enum, EnumVariant, FieldSource, Function, HasSource, ImplBlock,
13 ImplBlock, Local, MacroDef, Module, ModuleDef, ModuleSource, Source, Static, Struct, 13 Local, MacroDef, Module, ModuleDef, ModuleSource, Source, Static, Struct, StructField, Trait,
14 StructField, Trait, TypeAlias, Union, VariantDef, 14 TypeAlias, Union, VariantDef,
15}; 15};
16 16
17pub trait FromSource: Sized { 17pub trait FromSource: Sized {
@@ -200,8 +200,7 @@ impl FromSource for StructField {
200 variant_def 200 variant_def
201 .variant_data(db) 201 .variant_data(db)
202 .fields() 202 .fields()
203 .into_iter() 203 .iter()
204 .flat_map(|it| it.iter())
205 .map(|(id, _)| StructField { parent: variant_def, id }) 204 .map(|(id, _)| StructField { parent: variant_def, id })
206 .find(|f| f.source(db) == src) 205 .find(|f| f.source(db) == src)
207 } 206 }
@@ -221,7 +220,7 @@ impl Local {
221 }; 220 };
222 Some(res) 221 Some(res)
223 })?; 222 })?;
224 let source_map = parent.body_source_map(db); 223 let (_body, source_map) = db.body_with_source_map(parent.into());
225 let src = src.map(ast::Pat::from); 224 let src = src.map(ast::Pat::from);
226 let pat_id = source_map.node_pat(src.as_ref())?; 225 let pat_id = source_map.node_pat(src.as_ref())?;
227 Some(Local { parent, pat_id }) 226 Some(Local { parent, pat_id })