diff options
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 18 | ||||
-rw-r--r-- | crates/ra_hir/src/semantics.rs | 4 |
2 files changed, 9 insertions, 13 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 9e2fa03f8..2854631c6 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -227,11 +227,9 @@ impl Module { | |||
227 | Some((name, def)) | 227 | Some((name, def)) |
228 | } | 228 | } |
229 | }) | 229 | }) |
230 | .flat_map(|(name, def)| | 230 | .flat_map(|(name, def)| { |
231 | ScopeDef::all_items(def) | 231 | ScopeDef::all_items(def).into_iter().map(move |item| (name.clone(), item)) |
232 | .into_iter() | 232 | }) |
233 | .map(move |item| (name.clone(), item)) | ||
234 | ) | ||
235 | .collect() | 233 | .collect() |
236 | } | 234 | } |
237 | 235 | ||
@@ -1298,10 +1296,8 @@ impl ScopeDef { | |||
1298 | let mut items = ArrayVec::new(); | 1296 | let mut items = ArrayVec::new(); |
1299 | 1297 | ||
1300 | match (def.take_types(), def.take_values()) { | 1298 | match (def.take_types(), def.take_values()) { |
1301 | (Some(m1), None) => | 1299 | (Some(m1), None) => items.push(ScopeDef::ModuleDef(m1.into())), |
1302 | items.push(ScopeDef::ModuleDef(m1.into())), | 1300 | (None, Some(m2)) => items.push(ScopeDef::ModuleDef(m2.into())), |
1303 | (None, Some(m2)) => | ||
1304 | items.push(ScopeDef::ModuleDef(m2.into())), | ||
1305 | (Some(m1), Some(m2)) => { | 1301 | (Some(m1), Some(m2)) => { |
1306 | // Some items, like unit structs and enum variants, are | 1302 | // Some items, like unit structs and enum variants, are |
1307 | // returned as both a type and a value. Here we want | 1303 | // returned as both a type and a value. Here we want |
@@ -1312,8 +1308,8 @@ impl ScopeDef { | |||
1312 | } else { | 1308 | } else { |
1313 | items.push(ScopeDef::ModuleDef(m1.into())); | 1309 | items.push(ScopeDef::ModuleDef(m1.into())); |
1314 | } | 1310 | } |
1315 | }, | 1311 | } |
1316 | (None, None) => {}, | 1312 | (None, None) => {} |
1317 | }; | 1313 | }; |
1318 | 1314 | ||
1319 | if let Some(macro_def_id) = def.take_macros() { | 1315 | if let Some(macro_def_id) = def.take_macros() { |
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs index e83eb1fdc..788bb3eb7 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs | |||
@@ -349,8 +349,8 @@ impl<'a, DB: HirDatabase> SemanticsScope<'a, DB> { | |||
349 | for item in items { | 349 | for item in items { |
350 | f(name.clone(), item); | 350 | f(name.clone(), item); |
351 | } | 351 | } |
352 | return | 352 | return; |
353 | }, | 353 | } |
354 | resolver::ScopeDef::ImplSelfType(it) => ScopeDef::ImplSelfType(it.into()), | 354 | resolver::ScopeDef::ImplSelfType(it) => ScopeDef::ImplSelfType(it.into()), |
355 | resolver::ScopeDef::AdtSelfType(it) => ScopeDef::AdtSelfType(it.into()), | 355 | resolver::ScopeDef::AdtSelfType(it) => ScopeDef::AdtSelfType(it.into()), |
356 | resolver::ScopeDef::GenericParam(id) => ScopeDef::GenericParam(TypeParam { id }), | 356 | resolver::ScopeDef::GenericParam(id) => ScopeDef::GenericParam(TypeParam { id }), |