aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/module.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/module.rs')
-rw-r--r--crates/ra_hir/src/module.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/crates/ra_hir/src/module.rs b/crates/ra_hir/src/module.rs
index c6bb76d56..d5866f6ef 100644
--- a/crates/ra_hir/src/module.rs
+++ b/crates/ra_hir/src/module.rs
@@ -271,15 +271,13 @@ pub struct ModuleData {
271 271
272impl ModuleSource { 272impl ModuleSource {
273 // precondition: item_id **must** point to module 273 // precondition: item_id **must** point to module
274 fn new(file_id: FileId, item_id: SourceFileItemId) -> ModuleSource { 274 fn new(file_id: FileId, item_id: Option<SourceFileItemId>) -> ModuleSource {
275 let source_item_id = SourceItemId { file_id, item_id }; 275 let source_item_id = SourceItemId { file_id, item_id };
276 ModuleSource(source_item_id) 276 ModuleSource(source_item_id)
277 } 277 }
278 278
279 pub(crate) fn new_file(db: &impl HirDatabase, file_id: FileId) -> ModuleSource { 279 pub(crate) fn new_file(file_id: FileId) -> ModuleSource {
280 let file_items = db.file_items(file_id); 280 ModuleSource::new(file_id, None)
281 let item_id = file_items.id_of_source_file();
282 ModuleSource::new(file_id, item_id)
283 } 281 }
284 282
285 pub(crate) fn new_inline( 283 pub(crate) fn new_inline(
@@ -290,7 +288,7 @@ impl ModuleSource {
290 assert!(!m.has_semi()); 288 assert!(!m.has_semi());
291 let file_items = db.file_items(file_id); 289 let file_items = db.file_items(file_id);
292 let item_id = file_items.id_of(file_id, m.syntax()); 290 let item_id = file_items.id_of(file_id, m.syntax());
293 ModuleSource::new(file_id, item_id) 291 ModuleSource::new(file_id, Some(item_id))
294 } 292 }
295 293
296 pub fn file_id(self) -> FileId { 294 pub fn file_id(self) -> FileId {