diff options
author | ice1000 <[email protected]> | 2019-12-05 13:28:31 +0000 |
---|---|---|
committer | ice1000 <[email protected]> | 2019-12-05 13:28:31 +0000 |
commit | 7702f690a9592605be71104ec9d0b732af940fcc (patch) | |
tree | 3ba9e21961170598f800ea24ed1f5a1a6b345ffa /crates/ra_ide/src | |
parent | 762915826ac6893036f8b5cd5e63677ed862f6d9 (diff) |
One pub function less is good!
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/parent_module.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/ra_ide/src/parent_module.rs b/crates/ra_ide/src/parent_module.rs index 616d69fce..aef3fa3df 100644 --- a/crates/ra_ide/src/parent_module.rs +++ b/crates/ra_ide/src/parent_module.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use ra_db::{CrateId, FileId, FilePosition}; | 3 | use ra_db::{CrateId, FileId, FilePosition, SourceDatabase}; |
4 | 4 | ||
5 | use crate::{db::RootDatabase, NavigationTarget}; | 5 | use crate::{db::RootDatabase, NavigationTarget}; |
6 | 6 | ||
@@ -21,7 +21,8 @@ pub(crate) fn parent_module(db: &RootDatabase, position: FilePosition) -> Vec<Na | |||
21 | 21 | ||
22 | /// Returns `Vec` for the same reason as `parent_module` | 22 | /// Returns `Vec` for the same reason as `parent_module` |
23 | pub(crate) fn crate_for(db: &RootDatabase, file_id: FileId) -> Vec<CrateId> { | 23 | pub(crate) fn crate_for(db: &RootDatabase, file_id: FileId) -> Vec<CrateId> { |
24 | let src = hir::ModuleSource::from_file_id(db, file_id); | 24 | let source_file = db.parse(file_id).tree(); |
25 | let src = hir::ModuleSource::SourceFile(source_file); | ||
25 | let module = | 26 | let module = |
26 | match hir::Module::from_definition(db, hir::InFile { file_id: file_id.into(), value: src }) | 27 | match hir::Module::from_definition(db, hir::InFile { file_id: file_id.into(), value: src }) |
27 | { | 28 | { |