aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db/src/helpers
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2021-03-20 09:04:01 +0000
committerKirill Bulatov <[email protected]>2021-03-20 20:18:43 +0000
commit81961dc035106dcfd29b894aae339261a0ba037b (patch)
treee6c303055fbe5c1c9de50cbc93c6469a2996a93e /crates/ide_db/src/helpers
parent104a19853e0d5560a21e6c6a31961ca592be1032 (diff)
Do not propose assoc items without qualifiers
Diffstat (limited to 'crates/ide_db/src/helpers')
-rw-r--r--crates/ide_db/src/helpers/import_assets.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/ide_db/src/helpers/import_assets.rs b/crates/ide_db/src/helpers/import_assets.rs
index 7c8844e95..dbc980ba9 100644
--- a/crates/ide_db/src/helpers/import_assets.rs
+++ b/crates/ide_db/src/helpers/import_assets.rs
@@ -304,10 +304,12 @@ fn path_applicable_imports(
304 return items_with_candidate_name 304 return items_with_candidate_name
305 .into_iter() 305 .into_iter()
306 .filter_map(|item| { 306 .filter_map(|item| {
307 let mut mod_path = mod_path(item)?; 307 if item_as_assoc(db, item).is_some() {
308 if let Some(assoc_item) = item_as_assoc(db, item) { 308 // unqualified assoc items are not valid syntax
309 mod_path.push_segment(assoc_item.name(db)?); 309 return None;
310 } 310 }
311
312 let mod_path = mod_path(item)?;
311 Some(LocatedImport::new(mod_path.clone(), item, item, Some(mod_path))) 313 Some(LocatedImport::new(mod_path.clone(), item, item, Some(mod_path)))
312 }) 314 })
313 .collect(); 315 .collect();