]> git.lizzy.rs Git - rust.git/blobdiff - crates/ide_completion/src/completions/record.rs
Merge #11481
[rust.git] / crates / ide_completion / src / completions / record.rs
index 13b47356197c69ed665cfb30dd23e979966f05a4..78d06231060d766dd78629e562792fcc6b23b51b 100644 (file)
@@ -63,11 +63,12 @@ pub(crate) fn complete_record_literal(
     }
 
     if let hir::Adt::Struct(strukt) = ctx.expected_type.as_ref()?.as_adt()? {
-        let module = if let Some(module) = ctx.module { module } else { strukt.module(ctx.db) };
+        if ctx.path_qual().is_none() {
+            let module = if let Some(module) = ctx.module { module } else { strukt.module(ctx.db) };
+            let path = module.find_use_path(ctx.db, hir::ModuleDef::from(strukt));
 
-        let path = module.find_use_path(ctx.db, hir::ModuleDef::from(strukt));
-
-        acc.add_struct_literal(ctx, strukt, path, None);
+            acc.add_struct_literal(ctx, strukt, path, None);
+        }
     }
 
     Some(())