mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
use Source for module, part 1
This commit is contained in:
parent
178d8e96b5
commit
0145d06515
7 changed files with 23 additions and 27 deletions
|
@ -129,10 +129,10 @@ impl NavigationTarget {
|
|||
}
|
||||
|
||||
pub(crate) fn from_module(db: &RootDatabase, module: hir::Module) -> NavigationTarget {
|
||||
let (file_id, source) = module.definition_source(db);
|
||||
let file_id = file_id.as_original_file();
|
||||
let src = module.definition_source(db);
|
||||
let file_id = src.file_id.as_original_file();
|
||||
let name = module.name(db).map(|it| it.to_string().into()).unwrap_or_default();
|
||||
match source {
|
||||
match src.ast {
|
||||
ModuleSource::SourceFile(node) => {
|
||||
NavigationTarget::from_syntax(file_id, name, None, node.syntax(), None, None)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue