From 81961dc035106dcfd29b894aae339261a0ba037b Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 20 Mar 2021 11:04:01 +0200 Subject: Do not propose assoc items without qualifiers --- crates/ide_db/src/helpers/import_assets.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'crates/ide_db/src/helpers') 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( return items_with_candidate_name .into_iter() .filter_map(|item| { - let mut mod_path = mod_path(item)?; - if let Some(assoc_item) = item_as_assoc(db, item) { - mod_path.push_segment(assoc_item.name(db)?); + if item_as_assoc(db, item).is_some() { + // unqualified assoc items are not valid syntax + return None; } + + let mod_path = mod_path(item)?; Some(LocatedImport::new(mod_path.clone(), item, item, Some(mod_path))) }) .collect(); -- cgit v1.2.3