diff options
author | ice1000 <[email protected]> | 2019-12-03 20:28:40 +0000 |
---|---|---|
committer | ice1000 <[email protected]> | 2019-12-04 23:30:42 +0000 |
commit | 5c5f90ba57c83499a44af33bf8b91b24254fb685 (patch) | |
tree | 839b5d523978918cde9f6aeceba6f8819214e856 /crates/ra_hir/src/code_model/src.rs | |
parent | 38853459e3d964cc7f635829cdc66f5faee33d85 (diff) |
Confluent `ModuleSource` usage
Diffstat (limited to 'crates/ra_hir/src/code_model/src.rs')
-rw-r--r-- | crates/ra_hir/src/code_model/src.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/crates/ra_hir/src/code_model/src.rs b/crates/ra_hir/src/code_model/src.rs index 083946729..d9bccd902 100644 --- a/crates/ra_hir/src/code_model/src.rs +++ b/crates/ra_hir/src/code_model/src.rs | |||
@@ -26,11 +26,7 @@ impl Module { | |||
26 | /// Returns a node which defines this module. That is, a file or a `mod foo {}` with items. | 26 | /// Returns a node which defines this module. That is, a file or a `mod foo {}` with items. |
27 | pub fn definition_source(self, db: &impl DefDatabase) -> InFile<ModuleSource> { | 27 | pub fn definition_source(self, db: &impl DefDatabase) -> InFile<ModuleSource> { |
28 | let def_map = db.crate_def_map(self.id.krate); | 28 | let def_map = db.crate_def_map(self.id.krate); |
29 | let src = def_map[self.id.local_id].definition_source(db); | 29 | def_map[self.id.local_id].definition_source(db) |
30 | src.map(|it| match it { | ||
31 | Either::Left(it) => ModuleSource::SourceFile(it), | ||
32 | Either::Right(it) => ModuleSource::Module(it), | ||
33 | }) | ||
34 | } | 30 | } |
35 | 31 | ||
36 | /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`. | 32 | /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`. |