From 34464ede3f57cbab4d6d1a67f36252cc22c02765 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 18 Mar 2021 21:36:52 +0100 Subject: Fix associated items not being appended to paths in import_assets --- crates/ide_db/src/helpers/import_assets.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'crates/ide_db') diff --git a/crates/ide_db/src/helpers/import_assets.rs b/crates/ide_db/src/helpers/import_assets.rs index e03ccd351..7c8844e95 100644 --- a/crates/ide_db/src/helpers/import_assets.rs +++ b/crates/ide_db/src/helpers/import_assets.rs @@ -304,7 +304,11 @@ fn path_applicable_imports( return items_with_candidate_name .into_iter() .filter_map(|item| { - Some(LocatedImport::new(mod_path(item)?, item, item, mod_path(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)?); + } + Some(LocatedImport::new(mod_path.clone(), item, item, Some(mod_path))) }) .collect(); } -- cgit v1.2.3