aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/module_tree.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/ra_hir/src/module_tree.rs b/crates/ra_hir/src/module_tree.rs
index d1dc3fa4b..7caebab0d 100644
--- a/crates/ra_hir/src/module_tree.rs
+++ b/crates/ra_hir/src/module_tree.rs
@@ -172,6 +172,7 @@ impl ModuleTree {
172 file_id: HirFileId, 172 file_id: HirFileId,
173 decl_id: Option<SourceFileItemId>, 173 decl_id: Option<SourceFileItemId>,
174 ) -> ModuleId { 174 ) -> ModuleId {
175 let is_root = parent.is_none();
175 let id = self.alloc_mod(ModuleData { 176 let id = self.alloc_mod(ModuleData {
176 file_id, 177 file_id,
177 decl_id, 178 decl_id,
@@ -295,6 +296,7 @@ fn resolve_submodule(
295 db: &impl HirDatabase, 296 db: &impl HirDatabase,
296 file_id: HirFileId, 297 file_id: HirFileId,
297 name: &Name, 298 name: &Name,
299 is_root: bool,
298) -> (Vec<FileId>, Option<Problem>) { 300) -> (Vec<FileId>, Option<Problem>) {
299 // FIXME: handle submodules of inline modules properly 301 // FIXME: handle submodules of inline modules properly
300 let file_id = file_id.original_file(db); 302 let file_id = file_id.original_file(db);
@@ -303,7 +305,7 @@ fn resolve_submodule(
303 let root = RelativePathBuf::default(); 305 let root = RelativePathBuf::default();
304 let dir_path = path.parent().unwrap_or(&root); 306 let dir_path = path.parent().unwrap_or(&root);
305 let mod_name = path.file_stem().unwrap_or("unknown"); 307 let mod_name = path.file_stem().unwrap_or("unknown");
306 let is_dir_owner = mod_name == "mod" || mod_name == "lib" || mod_name == "main"; 308 let is_dir_owner = is_root || mod_name == "mod";
307 309
308 let file_mod = dir_path.join(format!("{}.rs", name)); 310 let file_mod = dir_path.join(format!("{}.rs", name));
309 let dir_mod = dir_path.join(format!("{}/mod.rs", name)); 311 let dir_mod = dir_path.join(format!("{}/mod.rs", name));